Sending attachments from CGI script using SMTP

perl India
  • 17 years ago


    hi all,
     I want to send a html page through email using SMTP. when i send the mail normally it is displaying the page as a plain text (i.e it is displaying the tags also).


     But I want it to be displayed as a html page, How can i achieve it ?


     I am using linux platform, and the code I am using for sending mails is


               use Net:MTP;
               $server='192.168.36.200';
               $smtp = Net:MTP->new($server,Debug=>1,port=>25) or print "Error cannot connect to mail server";


               $smtp->mail('[email protected]');
               $smtp->to('[email protected]');


               $smtp->data();
               $smtp->datasend("To: Vardhman\n");
               $smtp->datasend("Subject: Sent from Psearch\n");
               $smtp->datasend("Content-Type:TEXT/HTML\n");
               $smtp->datasend("\n");
               $smtp->datasend("<html><head>A simple test message</head><body><hr><h1>simple test program</h1></body></html>");
               $smtp->dataend();
               $smtp->quit;


       I tried changing the content-type but i didn't succeed, Any help plsssssssss

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“If Java had true garbage collection, most programs would delete themselves upon execution.” - Robert Sewell