Hi all,
I try to find solution to send mail with macros via SMTP
how to add attachment?![]()
Private Sub CommandButton1_Click() Dim Mail As New Message Dim Config As Configuration: Set Config = Mail.Configuration Config(cdoSendUsingMethod) = cdoSendUsingPort Config(cdoSMTPServer) = “smtp.gmail.com” Config(cdoSMTPServerPort) = 25 Config(cdoSMTPAuthenticate) = cdoBasic Config(cdoSMTPUseSSL) = True Config(cdoSendUserName) = “youremail@gmail.com” Config(cdoSendPassword) = “yourgmailpassword” Config.Fields.Update Mail.To = “your_recipient@whereever.com” Mail.From = Config(cdoSendUserName) Mail.Subject = “Subject from VBA” Mail.HTMLBody = “Body from VBA” Mail.Send MsgBox “Sent” End Sub
thank you in advance!
Bookmarks