Bulk Email VBA need support

sanket_sk

Board Regular
Joined
Dec 27, 2016
Messages
140
Office Version
  1. 365
Platform
  1. Windows
Hi There,

Greetings !!!

Please refer to below code, I got this code from one of the YouTube video (courtesy to Mr. Dinesh Kumar Takyar)

I have changed this code as per my requirement ( Server name and other things), however, this code is not working for me.

Could you please help me in getting this code corrected.


Sub email_ThroughLive()

Dim myMail As CDO.Message

Set myMail = New CDO.Message

'Enable SSL Authentication

myMail.Configuration.Fields.Item _

(http://schemas.microsoft.com/cdo/configuration/smtpusessl) = True

'SMTP authentication Enabled

myMail.Configuration.Fields.Item(http://schemas.microsoft.com/cdo/configuration/smtpauthenticate) = 1

'Set the SMTP server and port details

myMail.Configuration.Fields.Item(http://schemas.microsoft.com/cdo/configuration/smtpserver) = "smtp.office365.com"

myMail.Configuration.Fields.Item(http://schemas.microsoft.com/cdo/configuration/smtpserverport) = 587

myMail.Configuration.Fields.Item(http://schemas.microsoft.com/cdo/configuration/sendusing) = 2

'Set your username and password for your Yahoo Account

myMail.Configuration.Fields.Item(http://schemas.microsoft.com/cdo/configuration/sendusername) = Sanket.katdare@outlook.com

myMail.Configuration.Fields.Item(http://schemas.microsoft.com/cdo/configuration/sendpassword) = "*********"

'Update all configuration fields

myMail.Configuration.Fields.Update

'Set the email properties

With myMail

.Subject = "Test Mail"

.From = Sanket.katdare@outlook.com

.To = Sanket.katdare@gmail.com

.CC = ""

.BCC = ""

.TextBody = "WMyFirst Mail"

End With

myMail.Send

MsgBox ("Mail sent")

'Set myMail Variable to Nothing to free memory

Set myMail = Nothing

End Sub


Thanks & Regards,

Sanket Katdare
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
this code is not working for me.
What does "not working" mean? What do you want to happen, and what happens instead?

If you are getting a runtime error, give the error code and description and the line of code that causes it.
 
Upvote 0
What does "not working" mean? What do you want to happen, and what happens instead?

If you are getting a runtime error, give the error code and description and the line of code that causes it.

Facing the following error.

1650030292394.png



Stuck at - myMail.Send

Sanket
 
Last edited:
Upvote 0
Where are you getting 587 as the SMTP port? Try 25 or 465.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,133
Messages
6,123,234
Members
449,092
Latest member
SCleaveland

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