-2

I installed "mailutils" package in both servers, in the first server the mail is sent using command line, the second server the mail is not sent:

dpkg --get-selections for first server:

# dpkg --get-selections | grep mail
heirloom-mailx                                  install
libmail-sendmail-perl                           install
libmailtools-perl                               install
libmailutils2                                   install
libreoffice-emailmerge                          install
mailutils                                       install
procmail                                        install
sendmail-base                                   install
sendmail-bin                                    install
sendmail-cf                                     install

dpkg --get-selections for second server:

# dpkg --get-selections | grep mail
libmailutils2                                   install
libreoffice-emailmerge                          install
mailutils                                       install

The command line is:

echo -e "File mp4 is finished on Thank you for using this script" 2>&1 | sed '1!b;s/^/To: MYID@gmail.com\nSubject: File coding is done\n\n/' | sendmail -t

And this is the php function:

<?php

error_reporting(E_ALL);

$send = mail('MYID@gmail.com', 'sujet', 'salut');

if($send) {
echo 'mail sent';
}
else
{
echo 'oho';
}

?>

Thanks in advance

Oum Alaa
  • 227
  • 3
  • 11

1 Answers1

0

Can your server send email if you call sendmail directly?

echo -e "File mp4 is finished on Thank you for using this script" 2>&1 | sed '1!b;s/^/To: MYID@gmail.com\nSubject: File coding is done\n\n/' | sendmail -t
williamli
  • 3,846
  • 1
  • 18
  • 30
  • The first server YES, the second one NO – Oum Alaa Jan 05 '16 at 03:20
  • I usually find setting up sendmail troublesome and is easy for mails sending out from your IP get marked as spam. For production applications, I use mail sending gateways like Mandrill / SendGrid (they do have free plans) which ensures my email get delivered and won't get marked as spam. It also require less setup in the server as these are just a few RESTful API calls. – williamli Jan 05 '16 at 03:23
  • I am just using mailutils before install postfix – Oum Alaa Jan 05 '16 at 03:25
  • Well, I installed postfix, now via command like it works, but via php mail function I am not receiving any mail, I edited my code above – Oum Alaa Jan 05 '16 at 05:13