Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

net::smtp 1

Status
Not open for further replies.

fietse

Programmer
Nov 6, 2003
8
0
0
NL
dous any one have an idea howto make an html header
with net::smtp ?
and where to post it

thx fietse,
example net::smtp script
#####

$smtp = Net::SMTP->new('smtp.server');
$smtp->mail('from mail adress');
$smtp->to('to mail adress');
$smtp->data();
$smtp->datasend("To: vissible to adress");
$smtp->datasend("Subject: subjet");
$smtp->datasend("mail");
$smtp->dataend();
$smtp->quit;

 
i already found it out :)
you can make an html mail with the fillowing line after subject:
im a bit ashamed bescause its quite simular to CGI :)
$smtp->datasend("Content-Type: text/html");
thats it

Fietse
 
i thougt maybe i should post the complete example

Here it is
a html mail with green background eek!! an test in tekst + test3 in bold
#!/usr/bin/perl
$smtp = Net::SMTP->new('smtp.provider.com');
#get local mail user :)
$smtp->mail($ENV{USER});
#to
$smtp->to('bla@bla.nl');
$smtp->data();
#visble to
$smtp->datasend("To: visible to adress");
#subject
$smtp->datasend("Subject: nice to have an html mail \n");
#content-type
$smtp->datasend("Content-Type: text/html");
#massage
$smtp->datasend(&quot;\n<html><body style='background:green'>test<br><b>test3</b></body></html>&quot;);
#end
$smtp->dataend();
$smtp->quit;

Fietse
 
oh for the copy paster u should stll put

use Net::SMTP;
below #!/usr/bin/perl
 
I use MIME::Lite for my HTML sending. It has a lot of special purpose items and many ways of handling attachments, inline images etc.

Give it a shot.
 
yeah i see its prity cool :)
unfortunatly the server on which it had too runs dousnt have the module and i can't install it there too.
but i read the perldoc and its much handyer indeed

Thx fietse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top