Welcome to WebmasterWorld Guest from 23.23.46.20

Forum Moderators: coopster & jatar k

variables in mail script

   
5:56 am on Mar 8, 2005 (gmt 0)

10+ Year Member



Hi everyone,
I have a mailing script, the message is formated in HTML and I am having trouble getting the sent messages to display variables. I have tried this <$ship_type_a> and just $ship_type_a but the mail message just shows the code and not the variable. I have echoed the variables to make sure they are present. I will keep searching for the answer which I am sure is simple.

Any body know the answer.

6:06 am on Mar 8, 2005 (gmt 0)

10+ Year Member



$message_body = "First part of message ".
$variable.
" Second part of message";

mail('somebodies@address.com', 'Email from PHP', $message, 'From: me@myplace.com');

More info. here;

[php.net...]

Cheers,
BAD

[edited by: coopster at 11:03 am (utc) on Mar. 8, 2005]
[edit reason] hooked up link [/edit]

5:37 am on Mar 10, 2005 (gmt 0)

10+ Year Member



Thanks mate,
I eventually figured it out by trial and error and ended up with something similar to what you had.

[$mail_message = '<html>Hello,<br>
Thanks for choosing xyz. This email confirms that your order has been successfully
submitted and has been received by us, please read it carefully and save it for
future reference.<br>
<br>
<strong><font size="5">Order Details:<br>
</font></strong>
<hr>
<br>
Customer ID :</html>';
$mail_message .=$id;
$mail_message .='<html><br>
Date : </html>';
$mail_message .=$date;......]

I now have the script working and mailing out very nicely formated messages. The only problem is that there is some problem with the content type I think?
I'm using this:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $mail_message, $headers);

Outlook displays the message but when you reply it won't display the whole message below you reply.
Maybe I need additional or new headers?:
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
and:
$boundary = '-----=' . md5( uniqid ( rand() ) );

What do you think?

I think more trial and error is the call!

OH yer, What does the 'Email from PHP' do in your mail command

mail('somebodies@address.com', 'Email from PHP', $message, 'From: me@myplace.com');

Cheers

6:04 am on Mar 10, 2005 (gmt 0)

10+ Year Member



What do you think?

Not sure about this, most HTML emails are snt as text as well. Perhaps Outlook only displays the text component when you reply which in your case is missing. Pull apart an HTML email and have a look.


OH yer, What does the 'Email from PHP' do in your mail command

mail('somebodies@address.com', 'Email from PHP', $message, 'From: me@myplace.com');

It's the subject.

Cheers,
BAD

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month