Some other guy just asked that a few pages back, so if you want to see how with sendmail look for that post, lately I sitched over to MIME::Lite however, and I think it makes my code look neater.
$message = qq~
<html>
This is my html message
</html>
~;
use MIME::Lite;
$msg = MIME::Lite->new(
From =>'me@yahoo.com',
To =>'someone@hotmail.com',
Subject =>'A Test Message',
Type =>'text/html',
Data =>"$message"
);
$msg->send; # Send the message
If you don't have MIME::Lite on your server, you can of course just use sendmail, but also you could download MIME::Lite from cpan.org and just put Lite.pm in your directory with your script and instead of use MIME::Lite; put
require "Lite.pm";
That's what I did and it works like a charm.
Also, if you use Mime Lite you can send attachments on a dime.
$msg = MIME::Lite->new(
From =>'me@yahoo.com',
To =>'you@hotmail.com',
Subject =>'A Test Message',
Type =>'multipart/mixed'
);
$msg->attach(Type =>'TEXT',
Data =>"MY NEW TEST!!!"
);
$msg->attach(Type =>'image/gif',
Path =>"$path/test.gif",
Filename =>'test.gif',
Disposition => 'attachment'
);
$msg->attach(Type =>'image/gif',
Path =>"$path/test2.gif",
Filename =>'test2.gif',
Disposition => 'attachment'
);
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.