Jump to content

Recommended Posts

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.