LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-09-2013, 10:14 PM   #1
Sogeking
LQ Newbie
 
Registered: Jun 2013
Posts: 2

Rep: Reputation: Disabled
Thumbs up PHP mail returns true (Message accepted for delivery), but the message is not sent


I have been trying for over a month to get this server to send mail. I am moving from 000webhost, where it worked fine, to my friends server. The php code in send mail is:
$subject = $u.", your infomation";
$message = "Your password is ".$p;
$from = "emailaddress@gmail.com";
$headers = "From:" . $from;
if(mail($e,$subject,$message,$headers))
$_SESSI ON['message']="message sent";
else $_SESSION['message']="error";

the sendmail path in php.ini is "/usr/sbin/sendmail -t -i"

etc/hosts:
000.000.000.000 inspiron-1000 inspiron-1000.
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
and the mail.log:
Jun 9 22:05:07 inspiron-1000 sendmail[24552]: r5A357t5024552: from=www-data, size=144, class=0, nrcpts=1, msgid=<201306100305.r5A357t5024552@inspiron-1000.>, relay=www-data@localhost
Jun 9 22:05:07 inspiron-1000 sm-mta[24553]: r5A357A8024553: from=<www-data@inspiron-1000>, size=367, class=0, nrcpts=1, msgid=<201306100305.r5A357t5024552@inspiron-1000.>, proto=ESMTP, daemon=MTA-v4, relay=ip6-localhost [127.0.0.1]
Jun 9 22:05:08 inspiron-1000 sendmail[24552]: r5A357t5024552: to=emailaddress@gmail.com, ctladdr=www-data (33/33), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30144, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (r5A357A8024553 Message accepted for delivery)

Last edited by Sogeking; 06-09-2013 at 10:24 PM.
 
Old 06-09-2013, 10:30 PM   #2
derekpock
Member
 
Registered: Apr 2012
Location: USA
Distribution: Elementary OS Luna
Posts: 83

Rep: Reputation: 4
More Info

I am the one whose server he is moving too, let me provide more information.

One step at a time, sendmail is not working at all.
For example
Code:
echo TEST EMAIL | sendmail address@domain.com
will not work. So if this does not work, PHP will definitly not work. That is what Sogeking is saying the first half of his post.

/etc/hosts was changed from
Code:
127.0.0.1 inspiron-1000 inspiron-1000
to
Code:
000.000.000.000 inspiron-1000 inspiron-1000
because 000.000.000.000 is our external ip address (placeholder).

We are not and will not use ip6 unless that is the ONLY way to do it. So that part of the /etc/hosts did not need to be displayed, but its there just because.

The mail.log is where we see our problem. There are no entries in the mail.err. www-data is the group-name of the user sending the mail. Inspiron-1000 is the hostname of the system sending the mail, (its both the long and short name since there are no dots in the name). Server is UbuntuServer 13.04. Reply if more info/file catting needed.

I believe the problem is because sendmail still tries to use localhost (127.0.0.1) instead of the external ip. ANY help is appreciated, unneeded "I have this problem too!!!" is NOT APPRECIATED. Thanks in advanced!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed message delivery 4245rtr Linux - Newbie 3 12-28-2011 08:34 AM
Mail delivery failed: returning message to sender kwaslee Linux - Server 2 02-09-2011 08:43 AM
Mail delivery failed: returning message to sender kwaslee Linux - Server 1 11-11-2010 03:11 AM
Html tags inside PHP mail body message. linuxlover.chaitanya Programming 7 03-12-2010 12:50 AM
exim autoreply with message delivery RudeLove Linux - Enterprise 1 10-26-2004 03:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration