simcoweb Posted October 18, 2006 Share Posted October 18, 2006 I have a contact form that when submitted would send the visitor a confirmation email containing the form info they completed. It also sends an email containing the form info to the member designated by their ID number. It's sending the confirmation email but not the email to the member. Here's the code:[code]<?php// start mail process$mailContent="--------CONTACT--------\n" ."Name: ".$name."\n" ."Location: ".$location."\n" ."E-mail: ".$email."\n\n--------PHONE--------\n" ."Phone: ".$phone."\n" ."Best time to call: ".$best_time."\n\n--------Details--------\n" ."Details: ".$details."\n";//----------------------------------$toAddress="" . $row['email'] . ""; /* change this! */$subject="Plateau Professionals Referral"; /* change this! */$recipientSubject="Plateau Professionals Confirmation"; /* change this! */$receiptMessage = "Thank you ".$name." for inquiring at PlateauProfessionals.com's website!\n\n\nHere is what you submitted to us:\n\n" ."--------CONTACT--------\n" ."Name: ".$name."\n" ."E-mail: ".$email."\n\n--------PHONE--------\n" ."Phone: ".$phone."\n" ."Location: ".$location."\n" ."Best time to contact? ".$best_time."\n" ."Inquiring About: ".$details."\n";//----------------------------------mail($email, $subject, $receiptMessage,"From:$toAddress");//----------------------------------mail($toAddress,$recipientSubject,$mailContent,"From:$email");[/code]This line:[quote]$toAddress="" . $row['email'] . ""; /* change this! */?>[/quote]is populated by a query/array. This represents the email address of the person/member the visitor wants to contact. The email confirmation the visitor receives shows the proper 'from' email address so I know it's populating that correctly. Why it sends one and not the other is the mystery. Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/24364-mail-sends-one-email-but-not-the-otherwhy/ Share on other sites More sharing options...
HuggieBear Posted October 19, 2006 Share Posted October 19, 2006 [quote author=simcoweb link=topic=111936.msg453942#msg453942 date=1161199221]This line:[code=php:0]$toAddress="" . $row['email'] . ""; /* change this! */[/code]is populated by a query/array. This represents the email address of the person/member the visitor wants to contact. The email confirmation the visitor receives shows the proper 'from' email address so I know it's populating that correctly. Why it sends one and not the other is the mystery. Anyone?[/quote]As you're not specifying $row['email'] anywhere, I'm assuming this is only part of your code, is this whole block inside a while loop?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/24364-mail-sends-one-email-but-not-the-otherwhy/#findComment-111117 Share on other sites More sharing options...
simcoweb Posted October 19, 2006 Author Share Posted October 19, 2006 Basically $row is established as part of a query. Here's the code:[code]<?php// need to get member data$sql2 = "SELECT * FROM plateau_pros WHERE memberid = '$memberid'";$results = mysql_query($sql2);$row = mysql_fetch_array($results);?>[/code]This query's results then are sprinkled throughout the page like this:[code]<?phpecho "<h2>Inquiry Sent!</h2><br><font class='bodytext'>Thank you for your contact submission! <b>" . $row['firstname'] . " " . $row['lastname'] ."</b> will respond to your inquiry as soon as possible. We also encourage you to contact <b>" . $row['firstname'] . " " . $row['lastname'] ."</b> directly by email or phone:<p><ul><li><a class='body' href='mailto:" . $row['email'] . "'>Click here to email</a></li><li>Phone: " . $row['phone'] . "</li><li>Mobile: " . $row['mobile'] . "</li></ul><br>\n";exit;?>[/code]As well as in that snippet your quoted where i've inserted the $row['email'] in order to have the email sent to the member chosen. The script is a contact form whereas the visitor first chooses a member they wish to contact. When they select that member the memberid is passed via the URL and snagged with a $_GET. Then the query is run based upon the $_GET['memberid'], extract that member's data and displays it where needed. That query code is right above the form mail code. But, there's no 'while' loop.The form is successfully emailing this one to the visitor:[quote]mail($email, $subject, $receiptMessage,"From:$toAddress");[/quote]but not this one to the member:[quote]mail($toAddress,$recipientSubject,$mailContent,"From:$email");[/quote]The one that does get sent to the visitor shows the proper return address which would be the member's email as placed by " . $row['email'] . " Quote Link to comment https://forums.phpfreaks.com/topic/24364-mail-sends-one-email-but-not-the-otherwhy/#findComment-111260 Share on other sites More sharing options...
HuggieBear Posted October 19, 2006 Share Posted October 19, 2006 ok, can you try something to humour me then... Can you change your database so that both the email addresses are the same, make the sending member's email address and the receiving member's email address the same as the one that successfully received the email, then see if they both turn up.This way, you'll know if it's the code or a mail delivery issue.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/24364-mail-sends-one-email-but-not-the-otherwhy/#findComment-111279 Share on other sites More sharing options...
simcoweb Posted October 19, 2006 Author Share Posted October 19, 2006 Ok, I chose a member id that has my email address in it and then used the same email address as the visitor. So, I should've received both emails. Neither one showed up.When I used my hotmail account as the visitor then it would show up in my hotmail account and the 'from' address would be the email address of the member which is the same one I just tried. It's a valid email address and I triple checked it.So, we know it will send to my hotmail account so it's not entirely a delivery problem. However, it wouldn't send to my domain account which is hosted on the server this script is running on. Ideas? Quote Link to comment https://forums.phpfreaks.com/topic/24364-mail-sends-one-email-but-not-the-otherwhy/#findComment-111298 Share on other sites More sharing options...
HuggieBear Posted October 19, 2006 Share Posted October 19, 2006 OK, so if you received it in your hotmail account, change both email addresses to your Hotmail account and see if both emails turn up.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/24364-mail-sends-one-email-but-not-the-otherwhy/#findComment-111302 Share on other sites More sharing options...
simcoweb Posted October 19, 2006 Author Share Posted October 19, 2006 Interesting...... both showed up in the Hotmail account. Quote Link to comment https://forums.phpfreaks.com/topic/24364-mail-sends-one-email-but-not-the-otherwhy/#findComment-111320 Share on other sites More sharing options...
HuggieBear Posted October 19, 2006 Share Posted October 19, 2006 In that case it is a delivery issue, and the problem's with your host, not your script.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/24364-mail-sends-one-email-but-not-the-otherwhy/#findComment-111322 Share on other sites More sharing options...
simcoweb Posted October 19, 2006 Author Share Posted October 19, 2006 heh...i'm not sure if i'm happy or sad. It's my server :'( But at least I know the code is good! ;DThanks for helping. Quote Link to comment https://forums.phpfreaks.com/topic/24364-mail-sends-one-email-but-not-the-otherwhy/#findComment-111347 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.