472,796 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 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 9674
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"...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.