I’m writing a simple mail client in Perl, that uses SMTP to log in a Mail server, and from there sends a mail to another E-mail address (on different host). I use raw SMTP commands, because strawberry perl doesn’t come with SASL.pm which is needed in order to authenticate. However, when the script tries to authenticate itself, it fails. I tried ‘AUTH LOGIN’ and ‘AUTH PLAIN’ mechanism but no luck. Here is an example:
EHLO example.com
AUTH LOGIN
YWxwaGE=
cGFzc3dvcmQ=
MAIL FROM:<alpha@example.com>
RCPT TO:<beta@betadomain.com>
DATA
Subject: sample message
From: alpha@example.com
To: beta@betadomain.com
Greetings,
Typed message (content)
Goodbye.
.
QUIT
EOT
“YWxwaGE=”, “cGFzc3dvcmQ=” are the user and password encoded in Base64. Whatever I submit the server always complains that either the username or the password is wrong. What do I do wrong?
Why not just install a module that supports SMTP with SASL? One of the advantages of Strawberry Perl is that you can easily install modules from CPAN.
For example, Email::Simple and Email::Sender: