WagoAppMail and Gmail

Hi!
Does anyone have working SMTP settings for Gmail?
I think I have tried all the possible combinations in WagoAppMail, already many times.
I’m trying to make runtime to send emails with attachment.

I’m using the App Password and have activated 2fa in Gmail settings.
As username I’m using the whole email address.
Thanks!

Hello,

Here is an example that I used:

PROGRAM SmtpSendFile
VAR 
    oSmtpSend           : WagoAppMail.FbSmtpSendFile;
    xTrigger            : BOOL;
    oStatus             : WagoAppMail.WagoSysErrorBase.FbResult;
    xError              : BOOL;
    xBusy               : BOOL;
    sServer             : STRING := 'smtp.gmail.com';
    wPort               : WORD   := 587;
    sUser               : WagoAppMail.WagoAppString.MaxString := 'wagotest@gmail.com';
    sPwd                : WagoAppMail.WagoAppString.MaxString := 'helloworld'; (*Use Gmail App Password - See WAGO Open Source Comm.*)
    eAuthentication     : WagoAppMail.eAuthentication := WagoAppMail.eAuthentication.eLOGIN;
    eEncryption         : WagoAppMail.eEncryption := WagoAppMail.eEncryption.eSTARTTLS;
    typSSL_Options      : WagoAppMail.WagoTypesCurl.typSSL_Options;
    tTimeout            : TIME;
    sFrom               : WagoAppMail.WagoAppString.MaxString;
    sTo                 : WagoAppMail.WagoAppString.MaxString := 'michael@wago.com';
    sCc                 : WagoAppMail.WagoAppString.MaxString;
    sBcc                : WagoAppMail.WagoAppString.MaxString;
    sSubject            : STRING := 'This message is send via WagoAppMail';
    sMessage            : STRING := 'This is the message text send via WagoAppMail';
    sAttachment         : STRING := '/var/log/aide.log';
END_VAR


oSmtpSend(
    xTrigger:= xTrigger,
    oStatus=> oStatus,
    xError=> xError,
    xBusy=> xBusy,
    sServer:= sServer,
    wPort:= wPort,
    sUser:= sUser,
    sPassword:= sPwd,
    eAuthentication:= eAuthentication,
    eEncryption:= eEncryption,
    typSSL_Options:= typSSL_Options,
    ttimeout:=tTimeout,
    sFrom:= sFrom,
    sTo:= sTo,
    sCc:= sCc,
    sBcc:= sBcc,
    sSubject:= sSubject,
    sMessage:= sMessage,
    sAttachment:=sAttachment);
1 Like

Typically, ı have encountered the problem with encryption before. Rest are like as Mike wrote down. Take into account that.

1 Like

Hi!
Thanks for the help!

Even if I set the settings as Mike mentioned, I’m getting error “The remote server denied curl to login”. Any idea what could it mean?
I also tried to set typSSL_Options.xVerifyPeer and typSSL_Options.xVerifyHost to false, but it didn’t help.

I’m able to ping smtp.google.com from the controller, so that part should be fine.

I’m using 750-8217 (28)


I found out that it works if I’m using another Gmail account!
So the problem might be that the original account is blocking this login attempt.
Has anyone experienced the same? How to unblock it?

There is a setting in the gmail/yahoo and etc. that allows 3rd party applications, below is the article where you have to set “app password”.