Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an issue with sendmail on my server (ubuntu 12.10) with php, mysql,and wordpress installed. Basically I want to create a contact form in my blog to receive emails from visitors directly into my gmail account but it doest work! I created a php file called testmail.php to recall it from the browser:

<?php

$to = 'MYEMAIL@gmail.com';

$subbject = 'TEST MAIL';

$msg = 'test test test test test test test test test test test test test test test';


$isMailed = mail($to, $subbject, $msg, 'From:me <test@test.com>');


if($isMailed)

 echo 'mail has been send to: ' . $to;

else

 echo 'mail has NOT been send..';

?>

But I dont receive anything! The /var/log/mail.log says:

NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA-v4: cannot bind: Address already in use

What do i do wrong? Where do I need to check? What info do you need more? I checked also into the spam folder, nothing.

Thank you!

share|improve this question
2  
The mail.log message appears to be a different issue (namely - two MTAS are trying to bind on the same port on your box). This may be messing up the delivery of the incoming mail on your server and deserves fixing anyway. As for the sending part: (1) jack up error logging in php.ini; (2)look in the web server log; (3) tell us what you saw. –  Alien Life Form Mar 14 '13 at 10:59
    
Than you for your reply. I have noticed this error lines in /etc/mail/sendmail.cf.errors: *** ERROR: FEATURE() should be before MAILER() *** ERROR: FEATURE() should be before MAILER() *** MAILER(local') must appear after FEATURE(always_add_domain')*** ERROR: FEATURE() should be before MAILER() *** MAILER(local') must appear after FEATURE(allmasquerade')*** ERROR: FEATURE() should be before MAILER() –  Francesco Mar 14 '13 at 11:41
    
About my web server log, here is the last entry: Mar 14 12:34:34 localhost sendmail[13648]: r2EBXpu0013648: Gaia [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA-v4 Mar 14 12:39:01 localhost CRON[13736]: (root) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -ignore_readdir_race -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete) Mar 14 12:40:01 localhost CRON[13768]: (smmsp) CMD (test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp) –  Francesco Mar 14 '13 at 11:45
    
( Sorry I dont know how to beter format in here :( –  Francesco Mar 14 '13 at 11:46
    
THe way to format better is to paste the info into the question, not add it in comments. –  Jenny D Apr 17 at 10:40
add comment

1 Answer 1

Stop sendmail from running. Then try to connect to port 25 with say telnet localhost 25 and see if you can connect. If you do, then you have two mail servers competing to connect like Alien Life Form commented. Is it possible that you still have postfix or exim enabled?

Now if using telnet or nc you do not connect to port 25, wait a few minutes and start sendmail again. Do you connect now? If yes, problem solved. For some reason you had a process that bound port 25 before sendmail could. You may need to check this further. If not, then something is blocking sendmail from binding at port 25. You have to look into that more carefully. lsof may be your friend.

share|improve this answer
    
Hi Adamo, Thanks for your reply. I had indeed postfix, I have now remove it and just sendmail is now installed. I can telnet my localhost on port 25 but the issue is not solved since I still dont receive emails by recalling the php script from the web browser. In /var/log/mail.log, the last entry is now the following: daemon MTA-v4: problem creating SMTP socket and NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA-v4: server SMTP socket wedged: exiting –  Francesco Mar 14 '13 at 12:13
    
What is actually the best to have between postfix, sendmail and exim? I mean also in regards of configuration –  Francesco Mar 14 '13 at 12:16
    
Now, when I try to send an email from telnet 127.0.0.1 25 it failed at the end with the following message: 421 4.3.0 collect: Cannot write ./dfr2EE1NXX008772 (bfcommit, uid=0, gid=135): No such file or directory Connection closed by foreign host. Any suggestions? Thanks :) –  Francesco Mar 14 '13 at 14:13
    
For someone with little experience with mail systems, I tend to believe that postfix is easier to setup. Others will say exim. You still seem to be having problems with your sendmail installation too, so it is best that you remove sendmail too, reboot the machine and reinstall it before continuing wth your setup –  adamo Mar 14 '13 at 14:18
    
is this message "Cannot write ./dfr2EE1NXX008772 (bfcommit, uid=0, gid=135): No such file or directory " a problem with the installation? I have already removed sendmail twice and reinstalled completely but still nothing. Do you however advice me to remove completely sendmail and install postfix? –  Francesco Mar 14 '13 at 14:32
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.