Sending email with php sendmail not working for primary domain
- Product & platform Engineering
Sending email with php sendmail not working for primary domain
I have been stuck to this problem on Linode Server. I was not able to send mails to my primary domain. It was giving following error in mail logs.
Nov 18 13:20:06 indidelights sendmail[4820]: sAI7o6ST004820: to==?utf-8?B?Uml0dSBB?= <ronak@mydomain.com>, ctladdr=auriga (1001/1001), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30853, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Apache was trying to handle the email locally on our server. When I looked at the log response I saw it was returning the following error.
User unknown
550 5.1.1 recepient@example.com
After following these steps the email was routed to the correct mail server. My setup is Ubuntu 12.04 with PHP 5 Apache2 and Sendmail.
- Edit the sendmail config file on the Apache server:
sudo nano /etc/mail/sendmail.mc
- At the end of the file add the following lines of code to handle email correctly:
define(`MAIL_HUB', `example.com.')dnl define(`LOCAL_RELAY', `example.com.')dnl
- Save the file and exit.
- Update the sendmail setup in the command prompt:
sudo sendmailconfig
Follow the steps, I said yes to everything
- Restart sendmail:
sudo service sendmail restart
- Try sending the email again. It should work now.
Related content
Toll mangement and command centre with TMCC
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results..
A Smarter Health Safety Solution
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results..
Building fastest loan portal in India
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results..
Toll mangement and command centre with TMCC
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results...
Toll mangement and command centre with TMCC
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results..
Entreprise IT Transformation and Automation
We understand user and market, create product strategy and design experience for customers and employees to make breakthrough digital products and services