Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 15th, 2000, 09:58 AM
miguelgarcia miguelgarcia is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 1999
Location: DeKalb, IL 60115
Posts: 7 miguelgarcia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
When sending email through perl, what do you have to do to enable HTML tags in the email?


Reply With Quote
  #2  
Old May 15th, 2000, 01:42 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
It's quite simple if you look at this script.

#############################################
#!/usr/local/bin/perl
$email = 'webmaster@devshed.com';
$youremail = 'your@email.com';
open (MAIL,"|/var/qmail/bin/qmail-inject");
print MAIL "Subject: HTML Emailn";
print MAIL "From: DevShed.com <$email>n";
print MAIL "To: miguelgarcia <$youremail>n";
print MAIL "Content-type: text/htmlnn";
print MAIL "<html><body><p>n";
print MAIL "<blink>Hello</blink></p>n";
print MAIL "</body></html>n";
close (MAIL);
print "Content-type: text/htmlnn";
print "DONEn";
############################################
The whole idea is that you are sending the BODY of your email in HTML, so place it right b4 the body of the message.

Reply With Quote
  #3  
Old May 23rd, 2000, 10:34 AM
miguelgarcia miguelgarcia is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 1999
Location: DeKalb, IL 60115
Posts: 7 miguelgarcia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I tried the code above and the "Content-type: text/html" shows in my email as part of the content.

I am using sendmail since I do not have qmail-inject installed on our server. Does sendmail not have the capability to send html formatted emails?

Reply With Quote
  #4  
Old May 24th, 2000, 12:14 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>I am using sendmail since I do not have..
Simply change that line to:

open (MAIL,"|/usr/sbin/sendmail -t");

>>the "Content-type: text/html" shows in my email as part of the content..
print MAIL "To: miguelgarcia <$youremail>n";
print MAIL "Content-type: text/htmlnn"; # make sure this line is in this position
print MAIL "<html><body><p>n";

#if you are using M$ outlook, you might need to remove one newline as:
print MAIL "Content-type: text/htmln";

Reply With Quote
  #5  
Old May 26th, 2000, 08:47 AM
miguelgarcia miguelgarcia is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 1999
Location: DeKalb, IL 60115
Posts: 7 miguelgarcia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yeah the problem was the extra "n" so now internet mail accounts and Microsoft email programs do recognize the html formatting.

I realized after sending the mail, thats the way it goes, that AOL and Lotus Notes did NOT recognize the html tags. Does anyone have any ideas for thoose browsers or maybe a more universal format????

Thanks for all help thus far.

Reply With Quote
  #6  
Old May 26th, 2000, 09:55 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>that AOL and Lotus Notes did NOT recognize the html tags.
So your clients/members complain about that?
Tell them go to http://www.aolsucks.com or block aol emails from registering. So AOL really can't read html email?
Lotus Notes, I dun know about it.

I suggest you not to send html emails if possible. Many people don't like to enable html email.

Reply With Quote
  #7  
Old June 2nd, 2000, 08:38 PM
pschon pschon is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 16 pschon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by miguelgarcia:
When sending email through perl, what do you have to do to enable HTML tags in the email?
[/quote]

I send html mail as an attachment. Of course I use an established module for this:

MIME::Lite

to give you an idea how easy it is:

attach $mail
Type =>'text/html',
Data =>$save_html;

$save_html is the html version of the email I am sending. Go to CPAN and lookup the documenation for that module. I use it a lot.

Peter




------------------
Exercise Your Brain,Read a Book

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > howto: HTML formatted email?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway