in reply to Re: Sending a email with file attachment with LWP ONLY
in thread Sending a email with file attachment with LWP ONLY

"It's true that LWP understands the mailto: protocol, so it may be able to send a composed message for you. I'm really not sure how mailto through HTTP works, and I'd be surprised if you can count on it working with every web server."

LWP's support for "mailto:" URIs doesn't involve HTTP at all - it just invokes /usr/sbin/sendmail and sends the mail that way. Similarly when LWP is passed a "file:" URI, it will happily read the file off your local system without any HTTP anywhere.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^3: Sending a email with file attachment with LWP ONLY
by aaron_baugher (Curate) on Jul 05, 2012 at 14:53 UTC

    Thanks for the correction. The LWP man page just said the message is "passed on to the mail system," and since it's formatted just like a POST HTTP request, I didn't know if that was on the local system or a remote one as in a more typical HTTP request. I didn't see how it could possibly work reliably through a web server, but didn't want to make too many assumptions. Since sendmail isn't available on all systems, that seems like a fairly brittle way to do it, when there are other mail modules that will talk SMTP as well.

    Aaron B.
    Available for small or large Perl jobs; see my home node.