[FreeBSD 5.2.1] Sendmail is being a b!tch

Glaanieboy

OSNN Veteran Addict
Joined
6 Mar 2002
Messages
2,628
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.
 
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.
 
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?
 
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.
 
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
 
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?
 
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
 
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)
 
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.
 
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.
 
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
 
btw for php its best to set the sendmail path to /var/qmail/bin/qmail-inject
 
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.
 
Doesnt matter all that much. And PHP likes to send sendmail flags which qmail-injecct might not understand.
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back