Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Net::SMTP - mass mail

by sacked (Hermit)
on May 09, 2004 at 19:02 UTC ( [id://351894]=note: print w/replies, xml ) Need Help??


in reply to Net::SMTP - mass mail

You wrote:

PS: I'm not sure if this is possible but can you send an email that will display html in html compatible email readers and text otherwise? (if so how would I encorporate this into my example)

This won't help if you have to use Net::SMTP, but MIME::Lite makes it a snap to send email with multiple parts of different mime types:
require MIME::Lite; $msg= MIME::Lite->new( From => $from_addr, To => $to_addr, Bcc => $bcc_list, Subject => $subject, Type => 'multipart/alternative', ); $msg->attach( Type => 'text/plain', Data => $some_plain_text, ); $msg->attach( Type => 'text/html', Data => $some_html, );
Note that MIME::Lite can send email via Net::SMTP using the send_by_smtp method (from the pod):
send_by_smtp ARGS... Instance method. Send message via SMTP, using Net::SMTP. The opt +ional ARGS are sent into Net::SMTP::new(): usually, these are MAILHOST, OPTION=>VALUE, ... Note that the list of recipients is taken from the "To", "Cc" and +"Bcc" fields. Returns true on success, false or exception on error.

Or you can set the delivery method using the class method send:
# change the delivery method and then call vanilla instance method sen +d() MIME::Lite->send(’smtp’, "smtp.myisp.net", Timeout=>60); # ... $msg->send();

Or you can set the delivery method by providing different arguments to the instance method send:
$msg->send(’smtp’, "smtp.myisp.net");
Can you provide any more information as to why you can only use Net::SMTP ?

--sacked

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://351894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-23 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found