×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Display of image in sending the mail using perl

Display of image in sending the mail using perl

Display of image in sending the mail using perl

(OP)
Hai Guys!


I tried to embed html file in the mail using

print MAIL "Content-type: text/html \n\n";

Here when i tried to import a image its not coming up iam using outlook to view my mail.Not the browser.

:)

RE: Display of image in sending the mail using perl

(OP)
open(MAIL,"|$mailprog -t");
$from='From@from.com';
$mailarray=$mailid.'@from.com';
    $|=1;
   print MAIL "To: $mailarray \n";
   print MAIL "From:$from \n";
   #print MAIL "Subject: Test \n\n";
   print MAIL "Content-Type: text/html \n\n";
   print MAIL "<html>\n";
   print MAIL "<head>\n";
   print MAIL "</head>\n";
   print MAIL "<body>\n";
   print MAIL "<img src=conbottom.gif>";
   print MAIL "<table border=\"0\" width=\"101\%\" height=\"68\" bgcolor=\"#0000CC\">";
   print MAIL "<tr>";
   print MAIL "<td width=\"100\%\" height=\"62\"><font face=\"Verdana\" size=\"4\" color=\"\#FFFFFF\"><b>Test</b></font></td>";
   print MAIL "</tr></table>";
   print MAIL "<p>&nbsp\;</p><p>&nbsp\;</p><p>&nbsp\;</p>";
   print MAIL "<p align=\"center\"><b><font face=\"Verdana\" size=\"3\">";
   print MAIL "<p align=\"center\"><b><font face=\"Verdana\" size=\"3\">$mail</font></b></p>";
   print MAIL "<br>";
   print MAIL "<p align=\"center\"><b><font face=\"Verdana\" size=\"2\">Information: </font></b></p>";
   print MAIL "<br>";
   print MAIL "<p align=\"center\"><b><font face=\"Verdana\" size=\"1\">Name:$name CategoryI: $text,Category II: $com,Category III: $subtext</font></b></p>";
      print MAIL "<p align=\"center\"><b><font face=\"Verdana\" size=\"2\"><a href=\"www.from.com/newdisplay.pl&;uid=$unid\"><img border=\"0\" src=\"http://www.from.com/test/conbutton.gif\"; width=\"182\" height=\"71\"></a></font></b></p>";
   print MAIL "<br>";
   print MAIL "</body>";
   print MAIL "</html>";
    $|=1;
   close (MAIL);

RE: Display of image in sending the mail using perl

(OP)
Here is the code which i wrote

open(MAIL,"|$mailprog -t");
$from='From@from.com';
$mailarray=$mailid.'@from.com';
   print MAIL "To: $mailarray \n";
   print MAIL "From:$from \n";
   #print MAIL "Subject: Test \n\n";
   print MAIL "Content-Type: text/html \n\n";
   print MAIL "<html>\n";
   print MAIL "<head>\n";
   print MAIL "</head>\n";
   print MAIL "<body>\n";
   print MAIL "<img src=conbottom.gif>";
   print MAIL "</body>";
   print MAIL "</html>";
    $|=1;
   close (MAIL);

Iam not able to display the subject in the mail what i need to put and also is there any other content type i need to use for  displaying the image.


RE: Display of image in sending the mail using perl

I'm not sure why yours does not work, but, this does.  Change the red to something valid and the <IMG SRC to something valid.  Maybe you can use this as a starting point and develop from there.


#!/usr/local/bin/perl
$mailprog = '/usr/lib/sendmail';
$hdr = 'Mail a gif';
$recipient = 'some.sap@nowhere.com';
$command = "$mailprog -f $hdr $recipient";

open (MAIL, "|$command") || die "Can't open $mailprog!\n";
print MAIL "From: Mr. Saps Boss\n";
print MAIL "Reply-To: \n";
print MAIL "Subject: Mail a gif in some embedded HTML\n";
print MAIL "Content-Type: text/html charset=iso-8859-1\n";
print MAIL "Precedence: bulk\n\n";
print MAIL "<html><body><IMG SRC=\"http://url.to.some.image\">
        <h1>testing html</h1></body></html>";
# Send mail to Recipient
close MAIL;
print "complete\n";
exit;

'hope this helps.....


 
 
 keep the rudder amid ship and beware the odd typo

RE: Display of image in sending the mail using perl

In your #commented subject line, there are two newlines.  A blank line indicates the beginning of the body, so if you uncommented that, then your content-type would end up in the body and not the header as you would want.  So, if you uncomment that line, then remove the second newline (\n).

BTW, if you

print MAIL qq~delimiting "the" strings "with" qq then you wouldn't have to \"escape\" any quotes~;


Sincerely,
 
Tom Anderson
CEO, Order amid Chaos, Inc.
http://www.oac-design.com

RE: Display of image in sending the mail using perl

(OP)
Thanks tom And goboating it works fine ,

But my problem is iam using mail client(outlook) to see
the emails ,Its coming up without the images ,When copy  the html (by right clicking) and view as html in the webserver it works fine,

If any one had this error ,Thanks buddys you people rock

Thendal
:)

RE: Display of image in sending the mail using perl

make sure you put full url's to your images.

adam@aauser.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close