homepage Welcome to WebmasterWorld Guest from 54.167.174.90
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
variables in mail script
gruntre

10+ Year Member



 
Msg#: 7263 posted 5:56 am on Mar 8, 2005 (gmt 0)

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.

 

badone

5+ Year Member



 
Msg#: 7263 posted 6:06 am on Mar 8, 2005 (gmt 0)

$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]

gruntre

10+ Year Member



 
Msg#: 7263 posted 5:37 am on Mar 10, 2005 (gmt 0)

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

badone

5+ Year Member



 
Msg#: 7263 posted 6:04 am on Mar 10, 2005 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved