brian_d_foy helped me understand that issues with the way all the modules Email::Stuff is using talk to one another make it necessary to pass through LocalHost and LocalPort variables in order to send mail via GMail:
"The problem is the long chain of modules with slightly different interfaces. I haven't narrowed it down, but somebody isn't setting LocalAddr and LocalPort, so when you try to configure things, IO::Socket::configure fails because IO::Socket::_sock_info fails since nothing set those hash entries:"
($laddr,$lport,$proto) = _sock_info($arg->{LocalAddr}, $arg->{LocalPort}, $arg->{Proto}) or return _error($sock, $!, $@);
So my solution ended up looking like this:
#!/usr/bin/perl use warnings; use strict; use Email::Stuff; my $LocalHost = 'jasmines.mikebaas.org'; my $LocalPort = '2525'; my $RemoteHost = 'smtp.gmail.com'; my $RemotePort = '465'; my $objst = Email::Stuff ->to($ARGV[0]) ->from($ARGV[1]) ->subject($ARGV[2]) ->text_body($ARGV[3]) ; $objst->send( 'SMTP', ssl => 1, Host => $RemoteHost, Port => $RemotePort, Proto => 'tcp', username => $ARGV[4], password => $ARGV[5], Debug => 1, LocalAddr => $LocalHost, LocalPort => $LocalPort, );
However, I cannot send emails one after the other in serial since the localport 2525 binds to 465 and doesn't let go. As far as I can see, there is no way to send a QUIT via Email::Stuff. If there were, I could create one connection per each email I wish to send via Gmail.
I've also tried sleeping in between each message but because that always seemed to produce random results. So I'm closer but not out of the woods yet.
In reply to Re: Using Email::Stuff to send SMTP mail through GMail
by initself
in thread Using Email::Stuff to send SMTP mail through GMail
by initself
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |