"using cdo/smtp/tls in vb6 to send email smtp.office365.com mail server" Code Answer

4

with this code, i get to send mail using cdo to office365.

    private message as cdo.message
private attachment, expression, matches, filenamematch, i

sub enviar_mail()

set message = new cdo.message
message.subject = "test mail"
message.from = "youremail@yourdomain.com"
message.to = ""
message.cc = ""
message.textbody = "my text body here"

dim configuration
set configuration = createobject("cdo.configuration")
configuration.load -1 ' cdo source defaults
configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"
configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "youremail@yourdomain.com"
configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpass"
configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true

configuration.fields.update

set message.configuration = configuration
message.send

end sub

By iamtheexplm06 on January 8 2022

Answers related to “using cdo/smtp/tls in vb6 to send email smtp.office365.com mail server”

Only authorized users can answer the Search term. Please sign in first, or register a free account.