Jump to content

Email >> user - not happening


kellyalan

Recommended Posts

Hi

 

Prior to a few months ago, when a user hit the final submit button on our site (fitness testing) - the athlete's report (actually an email with a link to view their results) would be automatically be emailed to them and we'd also get an email confirming the test was taken. 

 

Now, we still get the confirmation email but the athlete doesn't receive an email. 

 

I've located this code and am wondering if there's additional code we need to add to get the process working again:

 

# Email the secret link to the athlete:
$i_secret_url = $set_baseurl.'report.php?sid='.$i_sid.'&a='.urlencode($i_passhash);
$i_headers = "From: ManOfSteeleSports.com <[email protected]>\nX-Mailer: ManOfSteeleSports.com PHP Mail v1.0\nReply-To: ManOfSteeleSports.com <[email protected]>\nX-Priority: 3 (Normal)";
$i_message = 'Dear '.stripslashes($i_rec1["fname"]).' '.stripslashes($i_rec1["lname"]).',
 
 
Thanks for the advice in advance!
Link to comment
https://forums.phpfreaks.com/topic/286949-email-user-not-happening/
Share on other sites

sorry - I'm not entirely sure that I'm pulling the code from the correct .php file but I hope so, here's more of the code.

 

If I should be looking for different code verbiage, please let me know what that may be and I'll go searching again. I was assuming that the bolded code below was what was sending the report directly to the client

 

# Check this report (id) is not ordered yet and get athlete's information:
$i_qry1 = db_qry("SELECT * FROM reports WHERE sid={$i_sid} AND ispurchased=0")
or die("Error: order-2, SQL request error #1 ".mysql_error());
if($i_qry1) {
if($i_rec1=mysql_fetch_array($i_qry1)) {
# Send a cc authorization/processing request to authorize.net:
$i_result = processCC($i_get_sid, $i_rec1["price"], $i_rec1["fname"], $i_rec1["lname"], $f_ccno, $f_ccexpdate_month, $f_ccexpdate_year, $i_rec1["address1"].' '.$i_rec1["address2"], $i_rec1["city"], $i_rec1["state"], $i_rec1["zip"], $i_rec1["email"]);
switch($i_result[0]) {
case 1:
# Set this order as completed:
$i_qry3 = db_qry("UPDATE reports SET ispurchased=1 WHERE sid={$i_sid}")
or die("Error: order-2, SQL request error #3 ".mysql_error());
 
# Request a secret hash:
$i_qry4 = db_qry("SELECT passhash FROM reports WHERE sid={$i_sid}")
or die("Error: order-2, SQL request error #4 ".mysql_error());
if($i_qry4) {
if($i_rec4=mysql_fetch_array($i_qry4)) {
       $i_passhash = $i_rec4["passhash"];
# Store this hash in the session:
session_register('r_pass');
$_SESSION['r_pass'] = $i_passhash;
setcookie("r_pass", $_SESSION['r_pass'], time()+60*60*24*354*15);
# Email the secret link to the athlete:
$i_secret_url = $set_baseurl.'report.php?sid='.$i_sid.'&a='.urlencode($i_passhash);
$i_headers = "From: ManOfSteeleSports.com <[email protected]>\nX-Mailer: ManOfSteeleSports.com PHP Mail v1.0\nReply-To: ManOfSteeleSports.com <[email protected]>\nX-Priority: 3 (Normal)";
$i_message = 'Dear '.stripslashes($i_rec1["fname"]).' '.stripslashes($i_rec1["lname"]).',
 
Thank you for purchasing the Mind of Steele Sports athletes
report product.
 
Please, keep this mail safe since you might need some of the
information at a later time, and read the following sections
of it carefully.
 
To access your report at our site, please click on this link:
 
'.$i_secret_url.'
 
<a href="'.$i_secret_url.'">AOL users click here</a>
 
Feel free to contact us at any time with questions; we will be
happy to serve you.
 
----
Best regards,
The Man of Steele Sports Team
@mail($i_rec1["email"], 'Man of Steele Sports - Thank You', $i_message, $i_headers);
# Display page with the report link:
include_once($DOCUMENT_ROOT."inc/top.inc.php");
echo '<h2>Thank you for your order!</h2>';
echo '<p>Thank you for your order from the <span class=mos>Man of Steele Sports</span> company!';
echo '<p>We value you as a customer and look forward to serving you again in the near future.';
echo '<p><a href="'.$i_secret_url.'" target=_blank><img src="images/view-report.gif" width=124 height=31 border=0></a>';
include_once($DOCUMENT_ROOT."inc/btm.inc.php");
}
db_free_result($i_qry4);
}

Why don't you echo the vars that are being used in the call to mail() and see if they are correct.  Also - lose the @ sign - you certainly want to see any possible problems now while you are testing this!

 

Also - use the proper tags when posting code here and on other forums. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.