Manheim
Manheim

Reputation: 13

Send email using AutoIt

I want to send email via Gmail (using AutoIt) but I do not know how to enable TLS. My code returns an error (4):

#include <Inet.au3>
#include <MsgBoxConstants.au3>
#Include<file.au3>

Local $sSMTPServer  = "smtp.gmail.com";
Local $sFromName    = "Emeka";
Local $sFromAddress = "[email protected]";
Local $sToAddress   = "[email protected]";
Local $sSubject     = "AuToIT";
Local $aBody[1]     = "Test ";

Local $iResponse    = _INetSmtpMail($sSMTPServer, $sFromName, $sFromAddress,$sToAddress, $sSubject, $aBody)
Local $iErr         = @error

If $iResponse = 1 Then

    MsgBox($MB_SYSTEMMODAL, "Success!", "Mail sent")

Else

    MsgBox($MB_SYSTEMMODAL, "Error!", "Mail failed with error code " & $iErr)

EndIf

Why is my email not being sent?

Upvotes: 0

Views: 2810

Answers (1)

Jumperz Ko
Jumperz Ko

Reputation: 401

https://www.digitalocean.com/community/tutorials/how-to-use-google-s-smtp-server

You need to check the google SMTP settings, I think. I once made a mail sender and got some stupid error that is easily fixed. Check link above.

Upvotes: 1

Related Questions