VBA Send Mail using SMTP - Help Needed

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
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top