corkg Posted January 3, 2008 Share Posted January 3, 2008 Hi I have this script to send a mail: mail($email,$subject,$message,"From:$strFrom\r\nReply-to: $strFrom\r\nContent-type: text/html; charset=us-ascii"); this works but how would I send this php script in the $message variable: <html> <head> <title>Daily Digest</title> <style> a{color:#000000; text-decoration:underline;} a:hover{color:#000000; text-decoration:none;}</style> </head> <body><? ?><hr color='black'> <font face='Verdana, Arial, Helvetica, sans-serif' size='3'><b>- Daily Digest for <?=$date?> -</b></font><? $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'")); $last=mysql_query("SELECT * FROM `last` WHERE `time` > '$fetchdigest->lastout' ORDER BY `time` DESC "); while($lastdisplay=mysql_fetch_object($last)){ ?> <? if($lastdisplay->type == "topic"){ $fetchtopics=mysql_fetch_object(mysql_query("SELECT * FROM topics WHERE id='$lastdisplay->postid'")); $image=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$fetchtopics->by'")); $imageset=mysql_fetch_object(mysql_query("SELECT * FROM user_settings WHERE username='$fetchtopics->by'")); $username1 = "$image->username"; ?> <hr color='black'> <div align="left"><font face='Verdana, Arial, Helvetica, sans-serif' size='2'><strong>Topic - <?php echo "<a href='http://www.chameleonmedia.co.uk/viewtopic.php?id=$fetchtopics->id'>$fetchtopics->title</a>"; ?></strong></font></div> <div align="left"><font face='Verdana, Arial, Helvetica, sans-serif' size='1'>Topic made by <? echo "<a href='http://www.chameleonmedia.co.uk/viewprofile.php?viewuser=$username1'>$username1</a> "; ?> on <?=$fetchtopics->posted?></font> </div> <hr color='black'> <div align="left"><font face='Verdana, Arial, Helvetica, sans-serif' size='1'> <? $topictextexpl=explode("-*---*-edit-***---*-*--", $fetchtopics->message); echo replace($topictextexpl[0]);?> </font> </div> <p> <?php }elseif($lastdisplay->type == "message"){ $right=mysql_fetch_object(mysql_query("SELECT * FROM messages WHERE id='$lastdisplay->postid'")); $righttop=mysql_fetch_object(mysql_query("SELECT * FROM topics WHERE id='$lastdisplay->messagein'")); $infouser = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$right->by'")); $rightset = mysql_fetch_object(mysql_query("SELECT * FROM user_settings WHERE username='$right->by'")); ?> </p> <hr color='black'> <div align="left"><font face='Verdana, Arial, Helvetica, sans-serif' size='2'><strong>Reply within the topic - <? echo"<a href='http://www.chameleonmedia.co.uk/viewtopic.php?id=$lastdisplay->messagein#$lastdisplay->postid'>$righttop->title</a>"; ?></strong></font></div> <div align="left"><font face='Verdana, Arial, Helvetica, sans-serif' size='1'>Reply made by <? echo "<a href='http://www.chameleonmedia.co.uk/viewprofile.php?viewuser=$right->by'>$right->by</a> "; ?> on <? echo"$right->date"; ?></font></div> <hr color='black'> <div align="left"><font face='Verdana, Arial, Helvetica, sans-serif' size='1'> <? $topicreplyexpl=explode("-*---*-edit-***---*-*--", $right->comment); echo replace($topicreplyexpl[0]); ?></font> </div> <p> <? }}?> </p> <hr color='black'></body> Thanks Link to comment https://forums.phpfreaks.com/topic/84269-solved-how-to-mail-code/ Share on other sites More sharing options...
psychowolvesbane Posted January 3, 2008 Share Posted January 3, 2008 Try reading this: http://msconline.maconstate.edu/tutorials/PHP/ECommerce/php00-15.php It says you would need to compose the message as HTML in line by line substrings $message ="" $message=$message & "<html>" $message=$message & "<$message>" etc. It will be long but that's how it's done. Link to comment https://forums.phpfreaks.com/topic/84269-solved-how-to-mail-code/#findComment-429171 Share on other sites More sharing options...
corkg Posted January 3, 2008 Author Share Posted January 3, 2008 Thanks I will try that and hope it will work Link to comment https://forums.phpfreaks.com/topic/84269-solved-how-to-mail-code/#findComment-429206 Share on other sites More sharing options...
rajivgonsalves Posted January 3, 2008 Share Posted January 3, 2008 the above won't work it should of been $message ="" $message=$message . "<html>" $message=$message . "<$message>" a "." instead of "&" Link to comment https://forums.phpfreaks.com/topic/84269-solved-how-to-mail-code/#findComment-429207 Share on other sites More sharing options...
corkg Posted January 3, 2008 Author Share Posted January 3, 2008 Yeah i worked that out and you don't need to wrap each of the tags in the "$message = $message . " you can string the bulk of it all together Thank you all Link to comment https://forums.phpfreaks.com/topic/84269-solved-how-to-mail-code/#findComment-429219 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.