phpretard Posted August 6, 2008 Share Posted August 6, 2008 I am trying to use phpMailer and everthing works fine except the variables won't send. It shows $thevariable not the value. Does anyone know anything about phpMailer? <?php session_start(); $mail = new PHPMailer(); // defaults to using php "mail()" $body = $mail->getFile('orderSendEmail2.php'); $body = eregi_replace("[\]",'',$body); $mail->From = "[email protected]"; $mail->FromName = "Me"; $mail->Subject = "Report"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $mail->AddAddress($_SESSION['email'], "Anthony"); // IT ISN"T PICKIN UP THIS SESSION EITHER $mail->AddAttachment("images/phpmailer.gif"); // attachment if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "<pre>". print_r($_SESSION,true) ."</pre>"; //// I ADDED THIS JUST TO SEE IF THE SESSION WERE THERE AND THEY ARE } ?> orderSendEmail2.php: <?php session_start(); include 'orderSessions.php'; /// THIS PAGE TRANSLATES THE SESSIONS INTO VARIABLES AND WORKS FINE ?> <style> #orderTitle{ font-weight:bold; font-size:14px; color:#006000; border-bottom:#000080 solid 2px; font-family:verdana; } #orderLable{ font-size:12px; padding:3px; font-family:verdana; } </style> <table border=0 width=100%> <tr> <td><b><font face=verdana>APPRAISAL ORDER REQUEST FORM</font></b></td> <td id=orderLable align=right></td> </tr> </table> <br><br> <div id=orderRequestForm style='width:678px; margin-bottom:10px;'> <table border=0 width=100%> <tr> <td colspan=2><div id=orderTitle>Company / Contact information</div></td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td id='orderLable' width=25%>Business:</td> <td width=75% id='orderLable'>$yourBusiness</td> </tr> <tr> <td id='orderLable' width=25%>Company:</td> <td width=75% id='orderLable'>$companyName</td> </tr> <tr> <td id='orderLable' width=25%>Contact Person:</td> <td width=75% id='orderLable'>$contactPersonFirst $contactPersonLast</td> </tr> <tr> <td id='orderLable' width=25%>Phone:</td> <td width=75% id='orderLable'>($phone1) $phone2 $phone3</td> </tr> <tr> <td id='orderLable' width=25%>Alternate Phone:</td> <td width=75% id='orderLable'>($altphone1) $altphone2-$altphone3</td> </tr> <tr> <td id='orderLable' width=25%>Fax Number:</td> <td width=75% id='orderLable'>($fax1) $fax2-$fax3</td> </tr> <tr> <td id='orderLable' width=25%>Email:</td> <td width=75% id='orderLable'>$email</td> </tr> <tr> <td id='orderLable' width=25% valign=top>Address:</td> <td width=75% id='orderLable'>$contactaddress<br>$contactcity, $contactstate $contactzip</td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td colspan=2><div id=orderTitle>Inspection And Property Access Information</div></td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td id='orderLable' width=25%>Property Type:</td> <td width=75% id='orderLable'>$service</td> </tr> <tr> <td id='orderLable' width=25%>Property Address:</td> <td width=75% id='orderLable'>$prop_address<br>$prop_city, $prop_state $prop_zip</td> </tr> <tr> <td id='orderLable' width=25%>Contact:</td> <td width=75% id='orderLable'>$contactForInspection</td> </tr> <tr> <td id='orderLable' width=25%>Contact Name:</td> <td width=75% id='orderLable'>$inspContactPersonFirst $inspContactPersonLast</td> </tr> <tr> <td id='orderLable' width=25%>Contact Phone Number:</td> <td width=75% id='orderLable'>($inspPhone1) $inspPhone2-$inspPhone3</td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td colspan=2><div id=orderTitle>Appraisal Detials</div></td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td id='orderLable' width=25%>Purpose:</td> <td width=75% id='orderLable'>$purpose</td> </tr> <tr> <td id='orderLable' width=25%>Sale Price:</td> <td width=75% id='orderLable'>$salePrice</td> </tr> <tr> <td id='orderLable' width=25%>Report Type:</td> <td width=75% id='orderLable'>$reportType</td> </tr> <tr> <td id='orderLable' width=25%>FHA:</td> <td width=75% id='orderLable'>$fha</td> </tr> <tr> <td id='orderLable' width=25%>Occupancy:</td> <td width=75% id='orderLable'>$occupancy</td> </tr> <tr> <td id='orderLable' width=25% valign=top>Comments:</td> <td width=75% id='orderLable'>$explainPurpose</td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td id='orderLable' colspan=2 align=right>Brought to you by: <img border=0 src='logoSMALL.gif' border=0></td> </tr> </table> </div> The email is formatted perfectly everything looks great but instead of mailing the values of the $vars it mails "$vars" Please help if you can. Link to comment https://forums.phpfreaks.com/topic/118371-solved-phpmailer-question/ Share on other sites More sharing options...
phpretard Posted August 6, 2008 Author Share Posted August 6, 2008 I should mention I have tried: <? echo $thevariable; ?> in the place of $thevariable in orderSendEmail2.php. It shows up blank in the email, but at least it doesn't show $thevariable. I will keep reading the manual until someone here can help. Link to comment https://forums.phpfreaks.com/topic/118371-solved-phpmailer-question/#findComment-609221 Share on other sites More sharing options...
DeanWhitehouse Posted August 6, 2008 Share Posted August 6, 2008 why not do this <?php session_start(); $mail = new PHPMailer(); // defaults to using php "mail()" $body = "<style> #orderTitle{ font-weight:bold; font-size:14px; color:#006000; border-bottom:#000080 solid 2px; font-family:verdana; } #orderLable{ font-size:12px; padding:3px; font-family:verdana; } </style> <table border=0 width=100%> <tr> <td><b><font face=verdana>APPRAISAL ORDER REQUEST FORM</font></b></td> <td id=orderLable align=right></td> </tr> </table> <br><br> <div id=orderRequestForm style='width:678px; margin-bottom:10px;'> <table border=0 width=100%> <tr> <td colspan=2><div id=orderTitle>Company / Contact information</div></td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td id='orderLable' width=25%>Business:</td> <td width=75% id='orderLable'>$yourBusiness</td> </tr> <tr> <td id='orderLable' width=25%>Company:</td> <td width=75% id='orderLable'>$companyName</td> </tr> <tr> <td id='orderLable' width=25%>Contact Person:</td> <td width=75% id='orderLable'>$contactPersonFirst $contactPersonLast</td> </tr> <tr> <td id='orderLable' width=25%>Phone:</td> <td width=75% id='orderLable'>($phone1) $phone2 $phone3</td> </tr> <tr> <td id='orderLable' width=25%>Alternate Phone:</td> <td width=75% id='orderLable'>($altphone1) $altphone2-$altphone3</td> </tr> <tr> <td id='orderLable' width=25%>Fax Number:</td> <td width=75% id='orderLable'>($fax1) $fax2-$fax3</td> </tr> <tr> <td id='orderLable' width=25%>Email:</td> <td width=75% id='orderLable'>$email</td> </tr> <tr> <td id='orderLable' width=25% valign=top>Address:</td> <td width=75% id='orderLable'>$contactaddress<br>$contactcity, $contactstate $contactzip</td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td colspan=2><div id=orderTitle>Inspection And Property Access Information</div></td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td id='orderLable' width=25%>Property Type:</td> <td width=75% id='orderLable'>$service</td> </tr> <tr> <td id='orderLable' width=25%>Property Address:</td> <td width=75% id='orderLable'>$prop_address<br>$prop_city, $prop_state $prop_zip</td> </tr> <tr> <td id='orderLable' width=25%>Contact:</td> <td width=75% id='orderLable'>$contactForInspection</td> </tr> <tr> <td id='orderLable' width=25%>Contact Name:</td> <td width=75% id='orderLable'>$inspContactPersonFirst $inspContactPersonLast</td> </tr> <tr> <td id='orderLable' width=25%>Contact Phone Number:</td> <td width=75% id='orderLable'>($inspPhone1) $inspPhone2-$inspPhone3</td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td colspan=2><div id=orderTitle>Appraisal Detials</div></td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td id='orderLable' width=25%>Purpose:</td> <td width=75% id='orderLable'>$purpose</td> </tr> <tr> <td id='orderLable' width=25%>Sale Price:</td> <td width=75% id='orderLable'>$salePrice</td> </tr> <tr> <td id='orderLable' width=25%>Report Type:</td> <td width=75% id='orderLable'>$reportType</td> </tr> <tr> <td id='orderLable' width=25%>FHA:</td> <td width=75% id='orderLable'>$fha</td> </tr> <tr> <td id='orderLable' width=25%>Occupancy:</td> <td width=75% id='orderLable'>$occupancy</td> </tr> <tr> <td id='orderLable' width=25% valign=top>Comments:</td> <td width=75% id='orderLable'>$explainPurpose</td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td width=25%> </td> <td width=75%> </td> </tr> <tr> <td id='orderLable' colspan=2 align=right>Brought to you by: <img border=0 src='logoSMALL.gif' border=0></td> </tr> </table> </div>"; $mail->From = "[email protected]"; $mail->FromName = "Me"; $mail->Subject = "Report"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $mail->AddAddress($_SESSION['email'], "Anthony"); // IT ISN"T PICKIN UP THIS SESSION EITHER $mail->AddAttachment("images/phpmailer.gif"); // attachment if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "<pre>". print_r($_SESSION,true) ."</pre>"; //// I ADDED THIS JUST TO SEE IF THE SESSION WERE THERE AND THEY ARE } ?> Link to comment https://forums.phpfreaks.com/topic/118371-solved-phpmailer-question/#findComment-609223 Share on other sites More sharing options...
phpretard Posted August 6, 2008 Author Share Posted August 6, 2008 I guess I havn't tried that because it works Link to comment https://forums.phpfreaks.com/topic/118371-solved-phpmailer-question/#findComment-609245 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.