Mahantesh_Torgal
New Member
- Joined
- Sep 12, 2016
- Messages
- 25
Hi Excel Guru's
I have typical issue with sending an email using SMTP in VBA.
currently Its sending Empty mail (email body missing) though i have coded correctly to include Email body.
Below code from : "http://www.rondebruin.nl/win/s1/cdo.htm", i have modified as per my need.
below is code:
---------------------------------------------------------
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Variant
Dim strbody As String
Dim i as Integer
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
i=100
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP.pfsweb.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
strbody = "Hi there" & vbNewLine & vbNewLine & _
"i value is :" & i
With iMsg
Set .Configuration = iConf
.To = "mtoragall@pfsweb.com"
.CC = ""
.BCC = ""
.From = "mtoragall@pfsweb.com"
.Subject = "Important message"
.TextBody = strbody
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
-----------------------------------------
Please help!!!!!!!!
Regards,
Mahantesh
I have typical issue with sending an email using SMTP in VBA.
currently Its sending Empty mail (email body missing) though i have coded correctly to include Email body.
Below code from : "http://www.rondebruin.nl/win/s1/cdo.htm", i have modified as per my need.
below is code:
---------------------------------------------------------
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Variant
Dim strbody As String
Dim i as Integer
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
i=100
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP.pfsweb.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
strbody = "Hi there" & vbNewLine & vbNewLine & _
"i value is :" & i
With iMsg
Set .Configuration = iConf
.To = "mtoragall@pfsweb.com"
.CC = ""
.BCC = ""
.From = "mtoragall@pfsweb.com"
.Subject = "Important message"
.TextBody = strbody
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
-----------------------------------------
Please help!!!!!!!!
Regards,
Mahantesh