![]() |
Perl Guru's
i have a script that uses the print command to send out email
how do i modify it to print out html? this is a sample print MAIL "Hello,\n"; print MAIL " Thank you for joining $sitename:\n"; print MAIL "\n"; print MAIL " Your details are below:\n\n"; now i want to insert html below this and then resume the email |
The email will have to be sent in either HTML OR plain text. What you'll need to do to send email in HTML is find the line
print MAIL "Subject: WHATEVER \n\n"; and below it add print MAIL "Content-type: text/html\n\n"; Make SURE you remove one of the newlines from the subject line so you end up with print MAIL "Subject: WHATEVER \n"; print MAIL "Content-type: text/html\n\n"; |
thanks bro
|
i had to do it this way armed
i kept fucking with it till i got it print MAIL "Content-type: text/html\n"; print MAIL "To: $emailok\n"; print MAIL "From: $adminmail\n"; print MAIL "Subject: $sitename\n\n"; i read the content type has to be the first thing sent then i figured the to from and subject gotto go next then the html :thumbsup |
If you're going to be sending html emails you might want to consider reading up on mime encoding. Here's a sample message that contains a plain text section and an html section. Just make sure your boundry tag is something that would never occur in the text of either message.
------------------------------------------------------------- Date: Mon, 29 Apr 2002 19:29:36 EDT Subject: testing To: [email protected] From: [email protected] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="part1_123456789.987654321_boundary" --part1_123456789.987654321_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit This is the plain text message --part1_123456789.987654321_boundary Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: 7bit <HTML> <H1>This is the HTML message</H1> </HTML> --part1_123456789.987654321_boundary-- |
geez that would take alot of work
would that even work with a perl generated email? |
It may, I don't understand the purpose of doing that though. To be honest, I have never fucked with it. In my line of work, there is no reason to send out a multipart email. I either send in text OR HTML. Not saying the other way won't work, just saying I have never done that.
Also, looks like your problem was the two newlines after the subject. Had you done print MAIL "Subject: WHATEVER \n"; print MAIL "Content-type: text/html\n\n"; It would have worked, but I suspect you left the two newlines in the subject line which would signify the end of the email header before the content type was specified. |
yeah i tried it exactly like you said.
it didnt work maybe it was the way the free script was wrote. i'm just hacking it to send html mail |
| All times are GMT -7. The time now is 10:12 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123