• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

[FreeBSD 5.2.1] Sendmail is being a b!tch

#1
This happens every time I try to send an email using the PHP mail() function (from /var/log/maillog):
Code:
Oct 17 17:44:01 server1 sm-mta[80036]: i9HFNwfp080034: to=<glaanieboy@msn.com>, delay=00:20:02, xdelay=00:20:02, mailer=esmtp, pri=30893, relay=mx4.hotmail.com. [65.54.190.230], dsn=4.0.0, stat=Deferred: Operation timed out with mx4.hotmail.com.
Same thing happens with gmail.com, wanadoo.nl addresses etc etc. php.ini is configured properly, sendmail seems to work ok, so I guess it's some setting in the OS, but where? Can anyone help me? :mad: I got it to work before on a FreeBSD 4.9 machine, so I am kinda frustrated now, since I copied/pasted the PHP code from a script I worked with before.
 

Reg

eXperienced!
#2
I've seen similar problems before with Hotmail and my own servers. It appears as though Hotmail will only accept mail from trusted servers. If you sendmail has the ability to determine this, they will block it if it's not trusted.
 
#3
Weird. I just sent a mail to my own wanadoo.nl (ISP) email address and it worked. Looks like gmail and hotmail/msn blocks my email. But why? It worked before (I know for sure, because I did a demonstration for a PHP product I made for a client about 3 weeks ago and there I used my gmail.com address as a test), why not now?
 
#4
I remember now! I used a qmail wrapper for sendmail, which I configured to send all emails to smtp.wanadoo.nl (my ISP's SMTP server). Does anyone know how I can configure sendmail to do the same? Because at the moment it seems to automagically detect the smtp.wanadoo.nl server, but still sending it as it was from server1.thuisnet.lan (localhost), which is an invalid domain.
 
#5
Finally! I found the answer on http://lists.freebsd.org/pipermail/freebsd-questions/2003-July/014468.html:
1. make sure sendmail is running. (ie remove sendmail_* lines from
/etc/rc.conf)
2. # cd /etc/mail
3. # cp freebsd.mc `hostname`.mc
4. edit `hostname`.mc and uncomment the following line:

define(`SMART_HOST', `your.isp.mail.server')

5. replace `your.isp.mail.server' with your Exchange server.
6. # make
7. # make install
8. # sh /etc/rc.sendmail restart
:D It worked. I immediately got 7 emails on my MSN account and 6 on my gmail account, all failed mails :D
 

X-Istence

*
Political User
#8
Yep:

runs as root standard
Required to run as root or it won't work
Always full of security holes
Does not seperate queue handling from incoming message handling. Can be done, but then mail gets slowed down till the queue handler sees the new mail.

It is a pain to configure properly, and secure. And did i mention it runs as root standard?
 
#9
you would do better to use one of the following 2 MTA's: qmail or postfix.

I swear by postfix, X-istance swears by qmail :)

and walk slowly away from sendmail: big bloated and insecure
 
#11
O...K, I installed qmail, changed sendmail_path to sendmail_path = /var/qmail/bin/sendmail -t -i, but it doesn't work. I guess I have to edit some config files, but I don't know how the file format is, so I guess I would have to look it up at some website, but I am tired atm so I'll see that tomorrow. Unless someone wants to help me *wink*wink* ;) (I only need to know how I redirect the qmail sendmail to an external SMTP)
 

X-Istence

*
Political User
#12
edit /var/qmail/control/smtproutes and add an entry:

:smtp.wanadoo.nl

Yes, include the coloon, or it will not work.

now svc -dx /var/qmail/services/*

within 5 seconds it will start working. Do note, that if you used some guide that uses inetd, youll have to either. If you used deamontools then just do what i said.

reboot
or somehow restart qmail.
 
#13
Uhm, ok. I didn't use daemontools, I installed it now, but I think I buggered up something, because I don't have a /var/qmail/services dir. I grabbed your guide from bsdguides.org, but it is packed with loads of stuff I don't need. I only need a redirect to an external SMTP, that's all.
 

X-Istence

*
Political User
#14
Glaanieboy said:
Uhm, ok. I didn't use daemontools, I installed it now, but I think I buggered up something, because I don't have a /var/qmail/services dir. I grabbed your guide from bsdguides.org, but it is packed with loads of stuff I don't need. I only need a redirect to an external SMTP, that's all.
you installed it all, but did not create any way to run it or anything.

run the following commands:

Code:
cd /usr/ports/mail/qmail
killall -9 sendmail
make fetch all install force-enable-qmail WITH_QMAILQUEUE_PATCH=yes WITH_BIG_TODO_PATCH=yes \
WITH_BIG_CONCURRENCY_PATCH=yes WITH_OUTGOINGIP_PATCH=yes
echo "no_sendmail=\"YES\"" >> /etc/make.conf
cd /usr/ports/sysutils/ucspi-tcp
make install clean
cd /usr/ports/sysutils/daemontools
make install clean
echo 'svscan_enable="YES"' >> /etc/rc.conf
cd /usr/ports/mail/qmail-conf/
make install clean
rm /usr/local/etc/rc.d/qmail.sh
hostname > /var/qmail/control/me
hostname | sed "s/`hostname -s`.//g" > /var/qmail/control/defaultdomain
hostname | sed "s/`hostname -s`.//g" > /var/qmail/control/plusdomain
/var/qmail/bin/qmail-smtpd-conf qmaild qmaill /var/qmail/service/smtpd
cd /var/qmail/service/smtpd/
echo "200" > env/CONCURRENCY
echo '127.0.0.1:allow,RELAYCLIENT=""' > tcp
echo ":allow" >> tcp
make
echo '#\!/bin/sh' > /var/qmail/rc
echo 'exec env - PATH="/var/qmail/bin:$PATH" \' >> /var/qmail/rc
echo 'qmail-start ./Maildir/ /usr/local/bin/multilog t /var/log/qmail qmaill' >> /var/qmail/rc
chmod 755 /var/qmail/rc
/var/qmail/bin/qmail-delivery-conf qmaill /var/qmail/service/qmail
mkdir /var/log/qmail
chmod 750 /var/log/qmail
chown qmaill /var/log/qmail
mkdir /var/service
ln -s /var/qmail/service/smtpd /var/service/smtpd
ln -s /var/qmail/service/qmail /var/service/qmail
echo ":smtp.wanadoo.nl" > /var/qmail/control/smtproutes
/usr/local/etc/rc.d/svscan.sh start
That should do it. Any local deliveries will be stuck in mail queue for 7 days as you don't have any local accounts, unless you:

Code:
cd /root
/var/qmail/bin/maildirmake Maildir
Which is suggested so that crontab can send its stuff there when needed.

X-Istence
 
#18
qmails sendmail wrapper just takes input from php and converts it to qmail-inject so there is no reason to change php at all when it detects the sendmail wrapper.
 

Members online

No members online now.

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,014
Latest member
sanoravies