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
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