468,720 Members | 1,551 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

Sending Email with Inline Images

hi all -

I have been tasked to send customized emails to a set of users based on a certain condition in my company. ( This is NOT SPAM )

I have used MIME::Lite successfully to send html templates as emails. the users in my company are Outlook users. But for some reason my emails sometimes reach the Junk E-Mail folder( I am sending using my own company issued email address )

Here's the code I currently use:
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. use strict;
  3. use diagnostics;
  4. use MIME::Lite;
  5. sub send_email()
  6. {
  7. open my $fh ,"data/address.txt" or die "Cannot open file:$!\n";
  8. my @filename =&fileread('htmlcode.htm');
  9. while(<$fh>)
  10. {
  11.     chomp;
  12.     my $msg = MIME::Lite->new( From =>"user\@host\.com",
  13.                                To =>$_,
  14.                                Subject =>"Action Required! Complete your Registration",
  15.                                Disposition =>'inline',                 
  16.                                Type    =>'multipart/related');
  17. $msg->attach(Type => 'text/html', Data => qq{@filename});
  18. $msg->attach(Type => 'image/gif',Id => 'img1.jpg',
  19.              Path => "images/img1.jpg");
  20. $msg->attach(Type => 'image/gif',Id => 'img2.gif',
  21.              Path => "images/img2.gif");
  22. $msg->attach(Type => 'image/gif',Id => img3.gif',
  23.              Path => "images/img3.gif");
  24. $msg->send("sendmail","/usr/sbin/sendmail -t");
  25. }
  26. close $fh;
  27. }
  28. &send_email(); 
The html is currently slurped into an array by the subroutine &fileread. the attachments in MIME::Lite are referred as 'cid:img2.gif...etc ' in the html templates.

Is there anyway to avoid the routing to the Junk mail folder in microsoft outlook ?

Thanks,
Santhosh
Dec 4 '07 #1
6 9271
KevinADC
4,059 Expert 2GB
As far as I know the answer is no unless you know why Outlook considers the email as junk, then you can change the subject line (or whatever needs changing) to avoid the dump into the junk folder.
Dec 5 '07 #2
KevinADC -
Thanks for the quick response ! Turns out there was a tag that wasn't compatible with Outlook that makes it mark as Junk E-mail.

Santhosh
Dec 6 '07 #3
eWish
971 Expert 512MB
What tag was it that was not compatible?

--Kevin
Dec 7 '07 #4
[HTML]<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
</head>[/HTML]

After removing this tag, the messages came through perfectly.

Santhosh
Dec 7 '07 #5
HI SSankar,
I was about to post this same thing in this forum and saw that you have already posted that. I am trying to make this work for a long time but no luck. Everytime it mails either as attachment or in mail body but without images.
As you said you have sorted it out can you please lend you help on this.
I am using linux for this. Users will send mail in a particular user account and .procmailrc will generate auto reply for that user with some html files with images based on subject of the mail.

Please help on this. Waiting for your kind response. Thanks in advance.
Dec 12 '07 #6
KevinADC
4,059 Expert 2GB
HI SSankar,
I was about to post this same thing in this forum and saw that you have already posted that. I am trying to make this work for a long time but no luck. Everytime it mails either as attachment or in mail body but without images.
As you said you have sorted it out can you please lend you help on this.
I am using linux for this. Users will send mail in a particular user account and .procmailrc will generate auto reply for that user with some html files with images based on subject of the mail.

Please help on this. Waiting for your kind response. Thanks in advance.
As SSankar said in the first post, they are using MIME::Lite, that is what you can do also. The problem SSankar had was the mail ended up in Outlooks junk folder, not adding images.
Dec 12 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

46 posts views Thread by DJ WIce | last post: by
3 posts views Thread by Ersin Gençtürk | last post: by
10 posts views Thread by Neo Geshel | last post: by
2 posts views Thread by Aneesh Pulukkul[MCSD.Net] | last post: by
1 post views Thread by runway27 | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Oskars | last post: by
9 posts views Thread by bryonone | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.