Jump to content

Recommended Posts

Posted (edited)

These settings work in Powershell but in Autoit 3.3.18.0 I get error:2. I also get an error:1 if no attachment or if I take AttachFiles completely out of the script. The password with or without spaces doesn't change anything.

#include <SmtpMailer.au3>

Local $s_SmtpServer = "smtp.gmail.com"
Local $s_FromName = "My Name"
Local $s_FromAddress = "fromme@gmail.com"
Local $s_ToAddress = "tome@gmail.com"
Local $s_Subject = "Subject"
Local $s_Body = "Body Message"
Local $s_Username = "fromme@gmail.com"
Local $s_Password = "abcdefghijklmnop" ; <--- Generated App Password
Local $s_AttachFiles = "C:\1.txt"
Local $IPPort = 587 ; Use 465 for SSL or 587 for TLS
Local $ssl = 1 ; Set to 1 for SSL

Local $s_Result = _SMTP_SendEmail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body, $s_Username, $s_Password, $s_AttachFiles, $IPPort, $ssl)

If @error Then
    MsgBox(0, "Error", "Mail failed with error: " & @error)
Else
    MsgBox(0, "Success", "Mail sent!")
EndIf


Mail failed with error:2

Edited by Jos

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...