I am trying to send emails to clients and I have some pre-formatted text at the top of the body of the email then I have a digital signature that I need to add before the end of the body of the email.
Please help me get the text and inline image to work correctly. The email is sent but the pre-formatted text is not pre-formatted and image is in the wrong place. Some text is wrapped past the image.
Below is the code I am using:
Michael Libeson
Please help me get the text and inline image to work correctly. The email is sent but the pre-formatted text is not pre-formatted and image is in the wrong place. Some text is wrapped past the image.
Below is the code I am using:
Code:
$sender = new Mail::Sender {
smtp => "$smtp",
auth => 'LOGIN',
authid => "$ARGV[0]",
authpwd => "$ARGV[1]",
keepconnection => 1,
client => "$smtp",
fromaddr => "$from",
from => "$from"
} or die "ERROR with set-up\n";
$Mail::Sender::NO_X_MAILER = 1;
$Mail::Sender::skip_bad_recipients = 1;
$gi = 1;
foreach $code ('AG', 'AD') {
$msgid = &createmessageid($code,$gi++);
$to = "$recipient";
$subject = "Ballot [$msgid]";
$msg = <<EOT;
<HTML><BODY><PRE>
To whom it may concern,
We look forward to receiving your statement.
Sincerely,
</PRE>
<IMG SRC="cid:tniv">
<PRE>
John Doe
</PRE></BODY></HTML>
EOT
$obj = $sender->OpenMultipart({
to => "$to",
subject => "$subject",
messageid => "$msgid",
priority => 1,
confirm => 'delivery',
type => 'multipart/related'
});
if (ref $obj) {
print STDOUT "Message ", $sender->{messageid}, " pending.\n";
} else {
print STDOUT "Message not sent. $obj\n";
}
$sender->Body(ctype => 'text/html; charset=us-ascii', msg => "$msg");
$sender->Attach({
description => 'NONE',
ctype => 'image/bmp',
encoding => 'base64',
disposition => "inline; filename=\"image.bmp\";\r\nContent-ID: <tniv>",
file => 'image.bmp'
});
$sender->Close();
}
exit(0);
sub createmessageid {
my ($c, $i) = @_;
return "MSGT$c$i";
}
Michael Libeson