• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

problem with mail on server

Hi i try to send message with php on my vps and i get this problem

Oct 24 03:18:20 fliskshinetwo postfix/pickup[6099]: C7B34203005D: uid=33 from=<www-data>
Oct 24 03:18:20 fliskshinetwo postfix/cleanup[9575]: C7B34203005D: message-id=<20111023231820.C7B34203005D@fliskshinetwo>
Oct 24 03:18:20 fliskshinetwo postfix/qmgr[15753]: C7B34203005D: from=<www-data@fliskshinetwo.info>, size=372, nrcpt=1 (queue active)
Oct 24 03:18:20 fliskshinetwo postfix/error[9578]: C7B34203005D: to=<umaxim1989@gmail.com>, relay=none, delay=0.15, delays=0.12/0.02/0/0.02, dsn=5.0.0, status=bounced (gmail.com)
Oct 24 03:18:20 fliskshinetwo postfix/cleanup[9575]: DE3322030193: message-id=<20111023231820.DE3322030193@fliskshinetwo>
Oct 24 03:18:20 fliskshinetwo postfix/qmgr[15753]: DE3322030193: from=<>, size=2087, nrcpt=1 (queue active)
Oct 24 03:18:20 fliskshinetwo postfix/bounce[9580]: C7B34203005D: sender non-delivery notification: DE3322030193
Oct 24 03:18:20 fliskshinetwo postfix/qmgr[15753]: C7B34203005D: removed
Oct 24 03:18:20 fliskshinetwo postfix/virtual[9581]: DE3322030193: to=<www-data@fliskshinetwo.info>, relay=virtual, delay=0.04, delays=0.01/0.02/0/0.02, dsn=5.1.1, status=bounced (unknown user: "www-data@fliskshinetwo.info")
Oct 24 03:18:20 fliskshinetwo postfix/qmgr[15753]: DE3322030193: removed

in my log mail.log

what can be problem
0
umaxim
Asked:
umaxim
  • 17
  • 14
  • 3
2 Solutions
 
umaximAuthor Commented:
message never come to my email
0
 
PapertripCommented:
This could be caused by several things, but it's hard to determine without seeing the NDR.

How are you invoking the script?  Is there a mailbox setup for user www-data?  If there is not a mailbox for that user, then you need to change the envelope-from address of the mails you are sending to point to a real mailbox.  How you do that would depend partially on how you are invoking the script.

Need more info!

On a side note, your SPF record needs some tuning.
[root@broken ~]# dig txt fliskshinetwo.info +short
"v=spf1 a mx"

Open in new window

That should, at the very least, be the following, however I'd change that even more and can discuss that with you if you want.
"v=spf1 a mx -all"

Open in new window

0
 
PapertripCommented:
It looks like www-data is the user running the apache processes.  Let's see the script you are using as well, or are you just using PHP mail() via Apache?

This should be easy to figure out once we find out how the mail is being generated/sent.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
umaximAuthor Commented:
just simple php

<?php
$to = "umaxim1989@gmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "info@fliskshinetwo.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
0
 
PapertripCommented:
Update your mail() syntax to the following:
mail($to,$subject,$message,$headers,'-finfo@fliskshinetwo.com');

Open in new window


The 5th argument in mail() is what will be passed as options directly to sendmail.

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path.
<?php
mail('nobody@example.com', 'the subject', 'the message', null,
   '-fwebmaster@example.com');
?>
http://php.net/manual/en/function.mail.php
0
 
PapertripCommented:
    -fname      Sets the name of the ``from'' person (i.e., the sender of the
                 mail).  -f can only be used by ``trusted'' users (normally
                 root, daemon, and network) or if the person you are trying to
                 become is the same as the person you are.
http://www.sendmail.org/~ca/email/man/sendmail.html
0
 
umaximAuthor Commented:
ok i found maybe becouse of this i have error i do not have domain fliskshinetwo.com i have fliskshinetwo.info how i can chage it maybe it will fix problem
0
 
umaximAuthor Commented:
it send me back this message

This is the mail system at host fliskshinetwo.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<umaxim1989@gmail.com>: gmail.com
0
 
PapertripCommented:
<?php
$to = "umaxim1989@gmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "info@fliskshinetwo.info";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers,'-finfo@fliskshinetwo.info');
echo "Mail Sent.";
?> 

Open in new window


FYI, your current SPF record says that any IP is allowed to send mail from fliskshinetwo.info, and could use a bit of other fine tuning.
0
 
umaximAuthor Commented:
i try it still send me the same message that message is not delivered as i showed before.
0
 
PapertripCommented:
Is there no other information in the bounce-back message you received?  Did you change the from field in your script and add the -f argument? Is there any additional info in /var/log/maillog ?

We should fix your SPF record, which could be causing this issue as well.  I've never seen an SPF record without the 'all' mechanism explicitly stated, so I'm not 100% certain how receivers will view that.  I am pretty certain however that if 'all' is not defined, that it defaults to '+all', but I'm not totally sure as I've never came across it before.

Anyways let's fix your SPF record for fliskshinetwo.info.

All that needs to be in your SPF record is the IP's of the server(s) allowed to send mail from your domain.

If for example the IP of your sending server is 1.2.3.4, then
"v=spf1 ip4:1.2.3.4 -all"

Open in new window

If you have additional servers, you can just add more ip4 mechanisms.
"v=spf1 ip4:1.2.3.4 ip4:1.2.35 -all"

Open in new window


If you are DKIM signing (you should be), then I suggest changing -all to ~all

Current:
[root@broken ~]# dig txt fliskshinetwo.info +short
"v=spf1 a mx"

Open in new window

0
 
PapertripCommented:
Curious, are you enforcing SELinux?

[root@broken ~]# getenforce
Enforcing

Open in new window

If you are, then turn the following boolean on if it is not already:
[root@broken ~]# getsebool httpd_can_sendmail
httpd_can_sendmail --> on
[root@broken ~]# setsebool -P httpd_can_sendmail on

Open in new window



0
 
umaximAuthor Commented:
I using ubuntu linux
0
 
PapertripCommented:
SELinux is not a distro, and can be ran on Ubuntu.  Since it appears to not be installed by default, you are probably not running it.  Aside from that, I think you would get a different error than you are seeing, so let's just not explore that route right now.  Fix your SPF record first and make sure you updated the php script like I suggested.

https://help.ubuntu.com/community/SELinux
https://wiki.ubuntu.com/SELinux
0
 
jonwilson0000Commented:
A common mistake is to turn on chroot operation in the master.cf file without going through all the necessary steps to set up a chroot environment. This causes Postfix daemon processes to fail due to all kinds of missing files.

The example below shows an SMTP server that is configured with chroot turned off:

/etc/postfix/master.cf:
    # =============================================================
    # service type  private unpriv  chroot  wakeup  maxproc command
    #               (yes)   (yes)   (yes)   (never) (100)
    # =============================================================
    smtp      inet  n       -       n       -       -       smtpd

Inspect master.cf for any processes that have chroot operation not turned off. If you find any, save a copy of the master.cf file, and edit the entries in question. After executing the command "postfix reload", see if the problem has gone away.

It looks like a postfix problem but could be way off course
0
 
umaximAuthor Commented:
I fix one problem with mail now it send i was need to reinstall mail server.

But now i have different problem when i send email to umaxim1989@gmail.com it come alright but when i send it to info@fliskshinetwo.info the same domain with php mail function from domain fliskshinetwo.info i never get it

In the mail log i see

Oct 25 08:08:49 fliskshinetwo sendmail[11426]: p9P48nRI011426: from=www-data, size=154, class=0, nrcpts=1, msgid=<201110250408.p9P48nRI011426@fliskshinetwo.info>, relay=www-data@localhost
Oct 25 08:08:49 fliskshinetwo sm-mta[11427]: p9P48num011427: <info@fliskshinetwo.info>... User unknown
Oct 25 08:08:49 fliskshinetwo sendmail[11426]: p9P48nRI011426: to=info@fliskshinetwo.info, ctladdr=www-data (33/33), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30154, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Oct 25 08:08:49 fliskshinetwo sm-mta[11427]: p9P48num011427: from=<www-data@fliskshinetwo.info>, size=154, class=0, nrcpts=0, proto=ESMTP, daemon=MTA-v4, relay=localhost.localdomain [127.0.0.1]
Oct 25 08:08:49 fliskshinetwo sendmail[11426]: p9P48nRI011426: p9P48nRJ011426: DSN: User unknown
Oct 25 08:08:49 fliskshinetwo sm-mta[11427]: p9P48nuo011427: from=<>, size=2117, class=0, nrcpts=1, msgid=<201110250408.p9P48nRJ011426@fliskshinetwo.info>, proto=ESMTP, daemon=MTA-v4, relay=localhost.localdomain [127.0.0.1]
Oct 25 08:08:49 fliskshinetwo sendmail[11426]: p9P48nRJ011426: to=www-data, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31178, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p9P48nuo011427 Message accepted for delivery)
Oct 25 08:08:49 fliskshinetwo sm-mta[11428]: p9P48nuo011427: to=<www-data@fliskshinetwo.info>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32348, dsn=2.0.0, stat=Sent
0
 
PapertripCommented:
It looks like postfix is no longer bound to port 25, but rather sendmail is, are you sure that is what you want running as your MTA instead of postfix?

If you do want sendmail as your MTA, then it is not configured properly and/or info@fliskshinetwo.info does not have an alias and/or local account on the server.
0
 
umaximAuthor Commented:
but i create account info@fliskshinetwo.info at google apps. My server did not send any message to google apps. It just never coming. On different mail like gmail.com it come with any problem
0
 
PapertripCommented:
This is starting to get messy, you keep introducing new elements to your question, like how sendmail is now your MTA and that you are now sending to your domain instead of from it, and that incoming mail for your domain is hosted by Google Apps.

Disregarding all of my previous answers, since you have a new "problem" and you apparently have not followed any of my advice regarding the php script or the SPF record, here is where we now stand.
[root@broken ~]# dig txt fliskshinetwo.info +short
"v=spf1 include:_spf.google.com ~all"
"v=spf1 a mx -all"

Open in new window

You can't have 2 SPF records.

Your SPF record should be the following, where 1.2.3.4 is the IP of your local sending server.
"v=spf1 ip4:1.2.3.4 include:_spf.google.com ~all"

Open in new window


Aside from that, it looks like you didn't make the changes to your php script since the logs say it's still from www-data@fliskshinetwo.info.

Helping you fix one problem is difficult when you make changes like this which create new problems.


0
 
umaximAuthor Commented:
ok i update my spf record i just have one now
0
 
umaximAuthor Commented:
ok i did all changes i resive mail on umaxim1989@gmail.com but i still did not resive email on google apps

new log

Oct 25 08:37:42 fliskshinetwo sendmail[11923]: p9P4bg2M011923: Authentication-Warning: fliskshinetwo.info: www-data set sender to info@fliskshinetwo.info using -f
Oct 25 08:37:42 fliskshinetwo sendmail[11923]: p9P4bg2M011923: from=info@fliskshinetwo.info, size=157, class=0, nrcpts=1, msgid=<201110250437.p9P4bg2M011923@fliskshinetwo.info>, relay=www-data@localhost
Oct 25 08:37:42 fliskshinetwo sm-mta[11924]: p9P4bg9O011924: <info@fliskshinetwo.info>... User unknown
Oct 25 08:37:42 fliskshinetwo sendmail[11923]: p9P4bg2M011923: to=info@fliskshinetwo.info, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30157, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Oct 25 08:37:42 fliskshinetwo sm-mta[11924]: p9P4bg9O011924: from=<info@fliskshinetwo.info>, size=157, class=0, nrcpts=0, proto=ESMTP, daemon=MTA-v4, relay=localhost.localdomain [127.0.0.1]
Oct 25 08:37:42 fliskshinetwo sendmail[11923]: p9P4bg2M011923: p9P4bg2N011923: DSN: User unknown
Oct 25 08:37:42 fliskshinetwo sm-mta[11924]: p9P4bg9Q011924: <info@fliskshinetwo.info>... User unknown
Oct 25 08:37:42 fliskshinetwo sendmail[11923]: p9P4bg2N011923: to=info@fliskshinetwo.info, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31181, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Oct 25 08:37:42 fliskshinetwo sm-mta[11924]: p9P4bg9Q011924: from=<>, size=1181, class=0, nrcpts=0, proto=ESMTP, daemon=MTA-v4, relay=localhost.localdomain [127.0.0.1]
Oct 25 08:37:42 fliskshinetwo sendmail[11923]: p9P4bg2N011923: p9P4bg2O011923: return to sender: User unknown
Oct 25 08:37:42 fliskshinetwo sm-mta[11924]: p9P4bg9S011924: from=<>, size=3963, class=0, nrcpts=1, msgid=<201110250437.p9P4bg2O011923@fliskshinetwo.info>, proto=ESMTP, daemon=MTA-v4, relay=localhost.localdomain [127.0.0.1]
Oct 25 08:37:42 fliskshinetwo sendmail[11923]: p9P4bg2O011923: to=postmaster, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32205, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p9P4bg9S011924 Message accepted for delivery)
Oct 25 08:37:43 fliskshinetwo sm-mta[11925]: p9P4bg9S011924: to=root, delay=00:00:01, xdelay=00:00:00, mailer=local, pri=34196, dsn=2.0.0, stat=Sent
0
 
umaximAuthor Commented:
ok not i resive message on different account of google apps. But still did not resive to the same one as i send info@fliskshinetwo.info.
0
 
umaximAuthor Commented:
I think i need to turn off local mail server in ehcp but i can not found where i can do it. in plesk i just click and it was disabled but what about ehcp
0
 
jonwilson0000Commented:
to uninstall ehcp from your server/computer,

just remove files at /var/www/ehcp
and files at /var/lib/mysql/ehcp

you have to be root to be able to do this.

But this now seems to be a different problem??
0
 
jonwilson0000Commented:
if you want to just stop running ehcp,
then you can just stop daemon, you may issue command:

/etc/init.d/ehcp stop
this will stop running ehcp daemon, which php runs it.

/etc/init.d/apache2 stop
will stop apache webserver

if you want to remove it totally then,
there is no automatic way,
you need to do two things:

1- remove directory that you installed ehcp, for example,
rm -rvf /var/www/vhosts/ehcp

2- delete ehcp database from your mysql server,
get into mysql console,
mysql
drop database ehcp

Ehcp also installs some server programs such as apache, mysql, postfix, etc.
you actually dont need to delete them, as they may be needed later on your system,
if you still want to delete all of them, then issue this command on your command line:

sudo apt-get remove php5 php5-imap php5-mysql php5-cli postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl phpmyadmin pure-ftpd-mysql mysql-server apache2 bind9 mysql-client

this will remove anything that ehcp installs...

Please let me know if getting rid of this then solves the problem or creates a new one which is very possible depending on what you are actually trying to do here?
0
 
PapertripCommented:
According to ns.fliskshinetwo.info, you still have 2 TXT records for your domain.
[root@broken ~]# dig @ns.fliskshinetwo.info txt fliskshinetwo.info +short
"v=spf1 a mx -all"
"v=spf1 ip4:208.93.118.125 include:_spf.google.com ~all"

Open in new window


Your local MTA thinks that it is the final destination for fliskshinetwo.info, and there is no local user or alias named 'info'.

Either create a user or alias named info on the mailserver so there is a local destination for info@fliskshinetwo.info, or tell sendmail route mail for fliskshinetwo.info to Google by using mailertable.

The following should work.
makemap hash /etc/mail/mailertable < /etc/mail/mailertable 
echo ".fliskshinetwo.info	esmtp:[ASPMX.L.GOOGLE.COM]:[ALT1.ASPMX.L.GOOGLE.COM]:[ALT2.ASPMX.L.GOOGLE.COM]:[ASPMX2.GOOGLEMAIL.COM]" >> /etc/mail/mailertable

Open in new window

0
 
PapertripCommented:
Woops, commands got reversed.

echo ".fliskshinetwo.info       esmtp:[ASPMX.L.GOOGLE.COM]:[ALT1.ASPMX.L.GOOGLE.COM]:[ALT2.ASPMX.L.GOOGLE.COM]:[ASPMX2.GOOGLEMAIL.COM]" >> /etc/mail/mailertable
makemap hash /etc/mail/mailertable < /etc/mail/mailertable 

Open in new window


Restart sendmail afterwards to make sure the changes are taken into account.
0
 
PapertripCommented:
Syntax revision #3
echo "fliskshinetwo.info       esmtp:[ASPMX.L.GOOGLE.COM]:[ALT1.ASPMX.L.GOOGLE.COM]:[ALT2.ASPMX.L.GOOGLE.COM]:[ASPMX2.GOOGLEMAIL.COM]" >> /etc/mail/mailertable
echo ".fliskshinetwo.info       esmtp:[ASPMX.L.GOOGLE.COM]:[ALT1.ASPMX.L.GOOGLE.COM]:[ALT2.ASPMX.L.GOOGLE.COM]:[ASPMX2.GOOGLEMAIL.COM]" >> /etc/mail/mailertable
makemap hash /etc/mail/mailertable < /etc/mail/mailertable 

Open in new window

0
 
umaximAuthor Commented:
ok i delete it now really delete it was in addition dns setting.
0
 
umaximAuthor Commented:
i need to do it in ssh
0
 
umaximAuthor Commented:
I did it and i still not receiving anything.
0
 
umaximAuthor Commented:
I did not try to remove ehcp i just trying to disable local mail server on it.
0
 
PapertripCommented:
At first you were using postfix, any reason you are now using sendmail instead?  Configuring postfix to do what is needed is quite simple.
0
 
umaximAuthor Commented:
ok i already fix problem thankx every one for help
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 17
  • 14
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now