randyvogl Posted December 22, 2008 Share Posted December 22, 2008 So here is the premise of the issue I have two places on my website where I am attempting to automatically send emails if a form is submitted using the mail() function. The first is a registration page, this works great email completes successfully and everyone is happy. The second location is the problem, it is being stopped by exchange IMF I believe it is this line that is causing the error when I print this line $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields it displays the following results "From: Do Not Reply" and missed the whole right half which has the send from: which I believe is flagging it in IMF but I can't figure out what is wrong with this syntax? Any thoughts? Ohh and this is the exact same code that is used on the other outbound email that works correctly which adds to my confusion. //this is a section of code to send the user an email confirmation with their username and password attached $Name = "Do Not Reply"; //senders name $email = "donotreply@xxxxxxxx.com"; //senders e-mail address $recipient = $_POST['email']; //recipient $mail_body = "Your file has been uploaded"; //mail body $subject = "Upload"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields ini_set('Do not reply', 'donotreply@xxxxxxxx.com'); //Suggested by mail($recipient, $subject, $mail_body, $header); //mail command Quote Link to comment https://forums.phpfreaks.com/topic/138024-can-anyone-find-the-problem-in-this-code/ Share on other sites More sharing options...
ngreenwood6 Posted December 22, 2008 Share Posted December 22, 2008 You need to change the name and email addresss in the $name and $email fields and the ini_set(). Quote Link to comment https://forums.phpfreaks.com/topic/138024-can-anyone-find-the-problem-in-this-code/#findComment-721384 Share on other sites More sharing options...
JonnoTheDev Posted December 22, 2008 Share Posted December 22, 2008 What is this line for? ini_set('Do not reply', 'donotreply@xxxxxxxx.com'); ini_set is for php configuration options. Quote Link to comment https://forums.phpfreaks.com/topic/138024-can-anyone-find-the-problem-in-this-code/#findComment-721388 Share on other sites More sharing options...
randyvogl Posted December 22, 2008 Author Share Posted December 22, 2008 Thanks for the replies thus far... sorry I didn't realize that I put in the ini_set that has since been taken out... my issue seems to be with the < in the header var? Is this an illegal operation? Is there a way around the issue? Quote Link to comment https://forums.phpfreaks.com/topic/138024-can-anyone-find-the-problem-in-this-code/#findComment-721415 Share on other sites More sharing options...
premiso Posted December 22, 2008 Share Posted December 22, 2008 it displays the following results "From: Do Not Reply" and missed the whole right half which has the send from: which I believe is flagging it in IMF but I can't figure out what is wrong with this syntax? Any thoughts? Ohh and this is the exact same code that is used on the other outbound email that works correctly which adds to my confusion. You do realize that if you print < > that to a screen without html_entities that string, you have to view the source to see the full tag. Chances are the header tag is fine, but since you are using HTML open and close <> without entiting them you will not see it cause it takes it as an html tag. View the source and you will see what I mean. Quote Link to comment https://forums.phpfreaks.com/topic/138024-can-anyone-find-the-problem-in-this-code/#findComment-721453 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.