web of unni

About | GuestBook | Add WebOfUnni to Google ToolBar

Download Day

September 26, 2007

Getting error when sending mail via cgiemail or php script

Filed under: cgiemail, exim, sendmail — unni @ 5:06 pm

If you are getting the error shown below when trying to send mail using “cgiemail” or php script you need to try following solution.
—————————————————————————————————–
root@server [~]# tail -f /var/log/exim_mainlog | grep domain.com
2007-08-21 12:27:57 1INRtt-0001qS-Jz ** user@domain.com R=checkspam2: Gid 99 is not permitted to relay mail, or has directly called /usr/sbin/exim instead of /usr/sbin/sendmail.
——————————————————————————————————

1. First check if /usr/sbin/sendmail is there and make sure that it is not a link to /usr/sbin/exim
2. Check the permissions. The permission should be as follows.

——————————————————————————————————-
-rwxr-sr-x 1 root mailtrap 10664 Sep 25 09:59 /usr/sbin/sendmail*
——————————————————————————————————-

Owner should be root and group should be mailtrap.

Make sure the group has sgid permission.
—————————————————————————————————-
root@admin [~]# ll /usr/sbin/sendmail
-rwxr-xr-x 1 root mailtrap 10548 May 7 16:36 /usr/sbin/sendmail*

root@admin [~]# chmod g+s /usr/sbin/sendmail

root@admin [~]# ll /usr/sbin/sendmail
-rwxr-sr-x 1 root mailtrap 10548 May 7 16:36 /usr/sbin/sendmai
——————————————————————————————————–

As our user Navneet suggested in the comment section removing the file “/etc/eximmailtrap” will also resolve the issue. Try that if the above doesn’t fix the issue.

=======================================
rm /etc/eximmailtrap
=======================================

If still the problem persists make a comment entry to this blog i will try to help you to resolve your probs.
Thank you … :-)

Created and maintained by Unnikrishnan
Hosted by Host cats