countryfan_nt
Well-known Member
- Joined
- May 19, 2004
- Messages
- 765
Hello friends, Hope all is well!
I am confused, there is nothing wrong with the code below (at least to my humble knowledge).
when the code reaches the line .Send, it pauses for say 15-20 seconds, and the code resumes, but nothing sent on outlook.
I used the same code in my previous organization and it was working. and there are no bugs.
Your kind help please!
Thank you for your continuous support
I am confused, there is nothing wrong with the code below (at least to my humble knowledge).
when the code reaches the line .Send, it pauses for say 15-20 seconds, and the code resumes, but nothing sent on outlook.
I used the same code in my previous organization and it was working. and there are no bugs.
Your kind help please!
Thank you for your continuous support
VBA Code:
Sub Send_Email(ByVal mailTo As String, _
ByVal mailCC As String, _
ByVal mailBCC As String, _
ByVal mailSubject As String, _
ByVal mailBody As String, _
ByVal mailAttachment As String)
Dim CDO_Mail_Object As Object
Dim CDO_Config As Object
Dim SMTP_Config As Variant
On Error GoTo debugs
Set CDO_Mail_Object = CreateObject("CDO.Message")
Set CDO_Config = CreateObject("CDO.Configuration")
CDO_Config.Load -1
Set SMTP_Config = CDO_Config.Fields
With SMTP_Config
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'please put your server name below
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "health.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
With CDO_Mail_Object
Set .Configuration = CDO_Config
.From = GetUserID & "@health.com"
.To = mailTo
.CC = mailCC
.BCC = mailBCC
.Subject = mailSubject
.TextBody = mailBody
If mailAttachment <> "" Then .AddAttachment mailAttachment
.Send
End With
Exit Sub
debugs:
'If Err.Description <> "" Then MsgBox Err.Description
End Sub