View Full Version : php mail
mgd711
06-25-2007, 01:33 AM
When I make a comment on my website I always get an e-mail to say that somebody has left a comment but when other people comment on my website and they fill out the e-mail address box I never get an e-mail regarding there comments however if they don't leave an e-mail address I get an e-mail.
Any suggestions on what might be wrong. I've had this same problem with PP v1.4 through to PP v1.6.
Mike
www.thefieryscotsman.com
Dkozikowski
06-25-2007, 02:32 AM
I or someone else will take a look into this.
I have never heard of it happening before so its all news to me :)
Thanks for pointing it out.
mgd711
06-25-2007, 04:27 AM
I or someone else will take a look into this.
I have never heard of it happening before so its all news to me :)
Thanks for pointing it out.
Thanks!
I've been using PP since Feb 2006 with V1.4. I had always assumed I had done something wrong with the install so never bothered much with it. However this past weekend I deleted everything and did a fresh install of PP v1.6. Still dosen't work!............ ahh! This was one of the things I was hoping a fresh install would fix. I've e-mailed my host, Yahoo, to see if there is anything extra that needs to be set up at there end but I have already configured phpmail on my Yahoo web admin page to send mail to admin at my domain. It always works when I leave a comment though.
Mike
www.thefieryscotsman.com
Dkozikowski
06-25-2007, 04:51 AM
Just to check before i go diving in the code,
your admin email address is filled out on the options page right?
if it's not the comment email function wont work.
mgd711
06-25-2007, 05:25 AM
Just to check before i go diving in the code,
your admin email address is filled out on the options page right?
if it's not the comment email function wont work.
Yes, the admin e-mail is filled out in the pixelpost options section.
It beats me that it works when people don't leave an e-mail address but when they leave an e-mail address it dosen't work.
Thanks,
Mike
dakwegmo
06-25-2007, 12:43 PM
mgd711 try this test, make a test comment, but use another email address on the same domain as your admin email address.
My suspicion is that sendmail is only configured to send email from addresses on your domain, or possibly only email boxes that are configured on your server. When pixelpost constructs the message it uses the commenter's email as the from address if they entered one, and the default admin address if they didn't. I'm just guessing, but it sounds like your mail server is seeing the foreign from address and refusing to relay the message. The test above should help determine whether this is the case.
dwilkinsjr, I think the easiest work around for this would be to construct the message so that the FROM address is always the configured admin email address, but use the header information to specify a REPLY-TO address if the commenter submitted one. Something like this in includes/functions_comments.php, from around line 279 (v.1.6).
// Additional headers
if ($comment_email!="") $headers .= "From: $comment_name <$admin_email>\n Reply-To: <$comment_email>\n";
else $headers .= "From: PIXELPOST <$admin_email>\n";
I have not tested this.
mgd711
06-25-2007, 11:55 PM
Dakwegmo,
I did the test and I recieved the e-mail. I posted another comment this time using a different e-mail address and nothing.
This is the last entry in the Mail Error log......
2007 Jun 25 23:49:53 Result: 9
2007 Jun 25 23:49:53 From address not in member domain. Message not sent.
Mike
Update............
I put your code into the Includes/functions_comments.php file and the e-mails are now sent.
Thanks,
Mike
dakwegmo
06-26-2007, 01:12 AM
From address not in member domain. Message not sent.
That pretty much confirms my suspicion. Since I couldn't test it, can you tell me whether when you hit reply if it goes to the admin email address or the users configured email address?
Also, remember you've just hacked the files, officially hacked PP isn't supported. The biggest problem with hacking files is with upgrading, but I imagine there will be something like this in the next release of PP, so you probably don't need to worry too much about it.
mgd711
06-26-2007, 08:23 AM
That pretty much confirms my suspicion. Since I couldn't test it, can you tell me whether when you hit reply if it goes to the admin email address or the users configured email address?
Also, remember you've just hacked the files, officially hacked PP isn't supported. The biggest problem with hacking files is with upgrading, but I imagine there will be something like this in the next release of PP, so you probably don't need to worry too much about it.
When I reply to the e-mails it goes to the admins e-mail address and not the person that left the comments.
Thanks for your help.
Mike
dakwegmo
06-26-2007, 12:58 PM
Ok. You can change this:
// Additional headers
if ($comment_email!="") $headers .= "From: $comment_name <$comment_email>\n";
else $headers .= "From: PIXELPOST <$admin_email>\n";
to this:
// Additional headers
if ($comment_email!="")
{$headers .= "From: $comment_name <$admin_email>\n";
$headers .= "Reply-To: $comment_name <$comment_email>\n"; }
else $headers .= "From: PIXELPOST <$admin_email>\n";
That should allow your emails to get through, and reply to commenters directly with your reply button.
Dkozikowski
06-26-2007, 01:07 PM
now you have it.
i have not tested but it looks better.
you were missing the \r\n in the origional code.
actually, you should probably edit your code slightly to add \r too
// Additional headers
if ($comment_email!="")
{$headers .= "From: $comment_name <$admin_email>\r\n";
$headers .= "Reply-To: $comment_name <$comment_email>\r\n"; }
else $headers .= "From: PIXELPOST <$admin_email>\r\n";
mgd711
06-26-2007, 10:06 PM
// Additional headers
if ($comment_email!="")
{$headers .= "From: $comment_name <$admin_email>\r\n";
$headers .= "Reply-To: $comment_name <$comment_email>\r\n"; }
else $headers .= "From: PIXELPOST <$admin_email>\r\n";
Installed this and test it, works a treat!
Thanks for your help Dakwegmo and Dwilkinsjr
Mike
www.thefieryscotsman.com
NO CARRIER
03-05-2008, 09:26 AM
I'd not recommend using \r in headers. Qmail scanner puts such messages in the quarantine because of "bad symbols in header".
This is correct one:
// Additional headers
if ($comment_email!="")
{$headers .= "From: $comment_name <$admin_email>\n";
$headers .= "Reply-To: $comment_name <$comment_email>\n"; }
else $headers .= "From: PIXELPOST <$admin_email>\n";
Dkozikowski
03-05-2008, 02:11 PM
The \r was added for our windows users. It was originally just \n
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.