I use python sendmail and gmail account in a python script.
Thanks (both) I’ll try these!
(I’ve built the mailx/nail package and I have a configuration file which works great on another system, but the ssl link fails on beaglebone).
Blake
Ok, looking at these options I need more more help I think…
“exim4 + gmail account” - exim4 does not seem to be available in the angstrom version I have and “opkg install exim4” can’t find it.
"python sendmail and gmail account " if this means installing sendmail, no thanks! (been there done that and it’s a royal pain).
Any other ideas out there? (do I need to switch to ubuntu for this basic capability?)
Blake
OK,
I’ve found a solution using perl.
-
upgrade perl using instructions at: http://www.impulseair.com.au/site/?p=244
-
as superuser: perl -MCPAN -e shell
-
install the packages used in the code below
-
code:
#!/usr/bin/perl -w
use strict;
use warnings;
use Net::SMTP;
use Net::SMTP::SSL;
use Authen::SASL;
my $smtps = Net::SMTP::SSL->new(“smtp.MYISP.com”, Timeout=>5, Debug=> 1, Port => 465) or die(“em2: can’t open my isp account!”);
my $acct_id = q\USER@ISP.com; # name@domain
my $acct_pw = q\PASSWORD;
my $dest_addr = “RECIPIENT@DOMAIN.TLD”; # name@domain
print “acctid: $acct_id passwd: $acct_pw\n”;
Note two argument standard form.
my $auth_return = $smtps->auth($acct_id, $acct_pw) or die("\n\nexample: AUTH FAILURE\n\n");
The mail() address must be your account’s user id or else you’ll get
the dreaded “553 From address not verified” error.
You cannot simply use $ENV{USER}.
my $mail_return = $smtps->mail($acct_id);
my $to_return = $smtps->to($dest_addr);
$smtps->data();
$smtps->datasend(“To: $dest_addr\n”);
$smtps->datasend(“From: $acct_id\n”); # Could be any address
$smtps->datasend(“Subject: Test of Sending with Net::SMTP::SSL from beaglebone\n”);
$smtps->datasend("\n"); # Between headers and body
$smtps->datasend(“This is the body, line1\n ************* \n”);
$smtps->datasend(“This is the body, line2\n”);
$smtps->dataend();
$smtps->quit;
print “\n----------------------------\n auth_return = $auth_return\n”;
print “------------------------------\n mail_return = $mail_return\n”;
print “------------------------------\n to_return = $to_return\n”;