Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Mail - what's the trick?

Status
Not open for further replies.

jwkolker

Programmer
Jan 9, 2003
68
0
0
US
Hi there - I have a site that sends mail from a script called mail.pl

The following let's a user know that a visitor has posted a message for them at the site.

I want to cleanup the URL so that it says "Click Here" to pick up your message instead of the dreadfully long URL string - take a look and let me know if you have any good ideas - I would also like to embed a gif at the beginning of the mail - (oh yeah what happens if the recipient does not have html mail enabled - is there a way to config that too?)

Here is the portion of the script that I would like to turn into HTML mail:
Code:
sub message_reply_message {

$subject = "Reply To Your Message";
$message = "You have received a reply from $form_data{'reply_name'} to the message that you sent through the $section_name section of the $classifieds_name.  To view your message, please go to the following URL:

$script_url?db=$form_data{'db'}&website=$form_data{'website'}&language=$form_data{'language'}&pickup_inbox_message_button=on&message_number=$userid

Please note that some mail programs may wrap or break this URL, which will cause clicking on it not to work.  If your mail program does this, you will need to copy and paste the full URL (possibly from several lines) into your web browser's \"Location\" field in order to see your message.  If you are still unable to view your message, then it has been deleted and is no longer available on the server.  Please do NOT contact us and ask us to retrieve your message for you under any circumstances, because we will be unable to do so.

This message will expire and be deleted from our server if you do not pick it up within $inbox_data_expiration_days days.
 
";

  }

Any help with this one will be greatly appreciated.

John Kolker
Programmer
jwkolker@comcast.net
 
To clean up the URL you could use a session identifier. This means putting a session token in the URL :

?SID=A543JET982

And then on the server tracking all the proper info as part of this SID in a text file or a database. Retrieve that info, substitute it into your CGI arguments and your code runs exactly as before.

Now, as far as html mail, easy, you can use MIME::Lite and Net::SMTP to do all sorts of great HTML Mail manipulations, including alternative types for those who can not read html mail.
 
Do you know a good source to learn more about using MIME::Lite and Net::SMTP to do all sorts of great HTML Mail manipulations, including alternative types for those who can not read html mail?

I have not idea how to do html mail - can't I just configure the script in mail.pl to be html?

JK


John Kolker
Programmer
jwkolker@comcast.net
 
Sorry to drag this one up again after a couple of weeks however would a re-arrangement of mail.pl to something like the following not solve jwkolkers problem ??

i.e. set content type to HTML at the start of the mail message

e.g.
$subject = "Reply To Your Message";
$message = &quot;<h1>Blah Blah</h1> ... <i>can have HTML formatting within</i> ... <a href=link.htm>your link</a>&quot;;

# next line assumes sendmail is installed and at the following path

$sendmail='/usr/sbin/sendmail';
open (MAIL, &quot;|$sendmail -t&quot;);
print MAIL <<EOMH;
From: Sender
To: recipient@mail.com
Subject: $subject
Content-Type: text/html\n\n
$message

EOMH

close (MAIL);


(in my experience an extra carriage return after the &quot;subject&quot; line messes things up somewhat !)

Its worth a try anyway...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top