JNameNotTaken
Programmer
Hello
I'm able to send mail ok using Net::SMTP but I have an issue I'm hoping sombody can please help with.
Code:
It works fine but, the content of the mail is not received in html format.
So, placing the lines highlighted above before the header is sent (see code comment) results in the mail being received in html format but, the header is part of the mail body and the subject is not reconised, i.e. their is no subject in the mail.
What is a guy to do?
If I set the content-type to text/html before the header, the header is not reconised as so and becomes part of the mail.
If I set the Content-type to text/html after the header it has no effect. The mail is received as text.
Any help would be great.
Thanks Very Much
I'm able to send mail ok using Net::SMTP but I have an issue I'm hoping sombody can please help with.
Code:
Code:
use Net::SMTP;
my $mail_body = "my html message";
my $smtp = Net::SMTP->new('smpt.mydomain.com');
$smtp->mail( $email ); #from email address
$smtp->to( $RECIPIENT_EMAIL ); #to email address
$smtp->data();
# SEND THE HEADER.
$smtp->datasend("From: " . $email . "\n");
$smtp->datasend("To: " . $RECIPIENT_EMAIL . "\n");
$smtp->datasend("Subject: " . $subject . "\n");
$smtp->datasend("\n");
# END SEND THE HEADER
##NOTE THESE LINES
$smtp->datasend("MIME-Version: 1.0\n");
$smtp->datasend("Content-Type: text/html; charset=us-ascii\n");
##############
$smtp->datasend("\n");
# Send the body.
$smtp->datasend( $mail_body );
$smtp->datasend("\n");
$smtp->dataend();
$smtp->quit;
It works fine but, the content of the mail is not received in html format.
So, placing the lines highlighted above before the header is sent (see code comment) results in the mail being received in html format but, the header is part of the mail body and the subject is not reconised, i.e. their is no subject in the mail.
What is a guy to do?
If I set the content-type to text/html before the header, the header is not reconised as so and becomes part of the mail.
If I set the Content-type to text/html after the header it has no effect. The mail is received as text.
Any help would be great.
Thanks Very Much