S
Sebastian Scholz
Hi
I wrote a small script to send a html mail with inline images using
mail:sender. Sending html mails without the images works fine, but when I
try to have the images sent with the mail I only get the html and the image
attached to the mail. I used the example for the mail:sender module but that
did not work. Here is my code snippet :
sub smtpmailer{
eval {
(new Mail::Sender)
->OpenMultipart({
smtp => 'mailserver',
from => 'my\@mailadress.com',
to => 'recepients\@mailadress.com',
auth => 'LOGIN',
authid => 'mymail login',
authpwd => 'my password',
subject => 'HTML Mail TEST',
boundary => '1234567890'
})
->Part({ ctype => 'multipart/related'
})
->Part({ ctype => 'text/html',
disposition => 'attachment',
msg => $htmlfile
})
->Attach({
description => 'test gif',
ctype => 'image/gif',
encoding => 'base64',
disposition => "inline;
filename=\"testygify.gif\";\r\nContent-ID:<img1>",
file => $imgfile
})
->EndPart("multipart/related")
->Close()
}
or die "Cannot send mail: $Mail::Sender::Error\n";
}
$htmlfile and $imgfile are the pathes to the files. Well, like I said,
sending that mail works but the html page is not displayed, just attached.
Any idea what is wrong ? I am also willing to use another method, but I need
a way to login onto the smtp server.
Thanks alot.
Sebastian
I wrote a small script to send a html mail with inline images using
mail:sender. Sending html mails without the images works fine, but when I
try to have the images sent with the mail I only get the html and the image
attached to the mail. I used the example for the mail:sender module but that
did not work. Here is my code snippet :
sub smtpmailer{
eval {
(new Mail::Sender)
->OpenMultipart({
smtp => 'mailserver',
from => 'my\@mailadress.com',
to => 'recepients\@mailadress.com',
auth => 'LOGIN',
authid => 'mymail login',
authpwd => 'my password',
subject => 'HTML Mail TEST',
boundary => '1234567890'
})
->Part({ ctype => 'multipart/related'
})
->Part({ ctype => 'text/html',
disposition => 'attachment',
msg => $htmlfile
})
->Attach({
description => 'test gif',
ctype => 'image/gif',
encoding => 'base64',
disposition => "inline;
filename=\"testygify.gif\";\r\nContent-ID:<img1>",
file => $imgfile
})
->EndPart("multipart/related")
->Close()
}
or die "Cannot send mail: $Mail::Sender::Error\n";
}
$htmlfile and $imgfile are the pathes to the files. Well, like I said,
sending that mail works but the html page is not displayed, just attached.
Any idea what is wrong ? I am also willing to use another method, but I need
a way to login onto the smtp server.
Thanks alot.
Sebastian