a***@gmail.com
2018-02-16 09:34:51 UTC
Hi All,
The first send email is successfully sent but next send (For Each classes in data) is got error with message is The message could not be send to the SMTP server and bla bla. Please help me and below the script.
Dim data
data = split("C:\data\1.docx,C:\data\2.docx,C:\data\3.docx::C:\data\4.docx,C:\data\5.docx::C:\data\6.docx", "::")
sendNow
Sub sendNow ()
Set eObj = CreateObject("CDO.Message")
For Each classes in data
eObj.From = "***@test.com"
eObj.To = "***@tester.com"
eObj.Subject = hello
eObj.TextBody = hello
'Attach files
files = split(classes, ",")
For Each item in files
eObj.AddAttachment item
Next
Set eConfig = eObj.Configuration
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.tester.com"
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "***@tester.com"
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "tester"
eConfig.Fields.Update
eObj.Send
End Sub
The first send email is successfully sent but next send (For Each classes in data) is got error with message is The message could not be send to the SMTP server and bla bla. Please help me and below the script.
Dim data
data = split("C:\data\1.docx,C:\data\2.docx,C:\data\3.docx::C:\data\4.docx,C:\data\5.docx::C:\data\6.docx", "::")
sendNow
Sub sendNow ()
Set eObj = CreateObject("CDO.Message")
For Each classes in data
eObj.From = "***@test.com"
eObj.To = "***@tester.com"
eObj.Subject = hello
eObj.TextBody = hello
'Attach files
files = split(classes, ",")
For Each item in files
eObj.AddAttachment item
Next
Set eConfig = eObj.Configuration
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.tester.com"
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "***@tester.com"
eConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "tester"
eConfig.Fields.Update
eObj.Send
End Sub