SharkBait Posted January 19, 2007 Share Posted January 19, 2007 Ok I am having a fun time trying to get my personal server running properly with sendmail and using php's mail() function.I send mail via [code=php:0]if(mail(NULL, $SUBJECT, $BODY, $HEADERS) ) { [/code] and it does not error. But the mail never is received at the location I am sending it to.When I telnet into the server via port 25 and send mail via the SMTP it works and my hotmail account receives the email using the same TO and FROM email addresses that I used in the php script.Running mailq says that there are not messages waiting.This is in the mail.log of the server:Jan 19 08:38:49 theshire sendmail[14760]: l0JGcnQk014760: from=www-data, size=255, class=0, nrcpts=1, msgid=<200701191638.l0JGcnQk014760@theshire.myserver.com>, relay=www-data@localhostJan 19 08:38:49 theshire sm-mta[14761]: l0JGcn7F014761: from=<www-data@theshire.myserver.com>, size=500, class=0, nrcpts=1, msgid=<200701191638.l0JGcnQk014760@theshire.mysever.com>, proto=ESMTP, daemon=MSP-v4, relay=localhost [127.0.0.1]Jan 19 08:38:49 theshire sendmail[14760]: l0JGcnQk014760: to=myemail@hotmail.com, ctladdr=www-data (33/33), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30255, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l0JGcn7F014761 Message accepted for delivery)Now in my php.ini file there is the line (which is commented out) for the sendmail path and argument;sendmail = Do I need to set the path of sendmail? By default it is using the SMTP settings I thought. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 19, 2007 Share Posted January 19, 2007 if(mail(NULL, $SUBJECT, $BODY, $HEADERS) ) { and it does not error. But the mail never is received at the location I am sending it to.Uhm, what location are you sending it to? You just said you're sending it to NULL which is not an email. Quote Link to comment Share on other sites More sharing options...
SharkBait Posted January 19, 2007 Author Share Posted January 19, 2007 This is my $HEADER[code]<?php$HEADERS = "MINE-Version: 1.0\r\n";$HEADERS .= "Content-Type: text/html; charset=iso-8859-1\r\n";$HEADERS .= "To: myaddress@hotmail.com\r\n";$HEADERS .= "From: {$email} \r\n";?>[/code]Which works find because I use it ofr other scripts on other websites. *edit: Doing my headers that way allows me to a) make HTML emails b) allows me to use Cc and BCc as well I think my problem was I was sending to myself with my own email address. I changed the FROM email to some random thing and it works fine.Now is it better to insert the users email address as the FROM or would it be better (this is a form that is being submitted) to use a server email address and just put the user's email addres in the body of the email along with the message? Quote Link to comment 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.