473,385 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 9749
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

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

Similar topics

46
by: DJ WIce | last post by:
Hi all, I did make a script/css thing to replace the contextmenu on the website with a new one: http://www.djwice.com/contextmenu.html It works nice in MSIE, but on Netscape (and probable...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
3
by: Ersin Gençtürk | last post by:
Is it possible to send images as inline images via asp.net send mail ? I don't want them to appear as attachments in the email.
10
by: Neo Geshel | last post by:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress 2005. Why? Because I can. Because I will gain experience. The one thing that has me stumped at square one is inline images....
0
by: shaolinman829 | last post by:
My collegue and I are at the point of pulling our hair out. I'm currently writting a little piece of Java code to send an email confirmation page that sends both html and text. Not a problem. In my...
2
by: Aneesh Pulukkul[MCSD.Net] | last post by:
Hi, I have a HTML page and associated images. I need to send the HTML as email -the email should also display the images at respective places. So am sending the content of HTML file as...
3
by: sreeraj1984 | last post by:
hi thanks for u reply,.................... Another problem How we can send email with inline images in c#........... I got the code for Screen shot capturing ...
7
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to...
1
by: runway27 | last post by:
<?php $headers = "Content-type: text/html; charset=iso-8859-1"; $to="myemailaddress"; $subject="Email Newsletter"; $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.