configuring sendmail to use ISP smtp for relaying.
This will document the steps needed to configure a linux server to send email via a relay.
Items needed:
1) ISP SMTP Server name or IP Address
2) Does your ISP allow un-authentication port 25 traffic?
3) Does your ISP prefer you to authenication yourself on port 25?
4) Does your ISP prefer you to use esmtp on port 587?
Step 1)
Log onto your Linux Server as root, or elevate yourself to root.
At this point you should be at a localhost# prompt.
Step 2)
You will need to install sendmail-cf , this will enable you to reconfigure the mail settings.
type: yum -y install sendmail-cf
Step 3)
Change to the /etc/mail folder. , you can do this by typing: cd /etc/mail
Step 4)
edit the sendmail.cf configuration file.
nano -w /etc/mail/sendmail.mc
(the -w means, DONT Word wrap lines) always use nano w/-w option...)
Find the following line:
dnl #
dnl define(`SMART_HOST', `smtp.your.provider')dnl
dnl #
You will want to change it to this:
dnl #
define(`SMART_HOST', `outbound.smtp.server.name')dnl
dnl #
If you are using an "IP" address and not a domain name, you would enter it like this:
dnl #
define(`SMART_HOST', `[111.111.111.111]')dnl
dnl #
note: IP addresses have the [] around them.
Also, you will also notice its a tilda to start, and single qoute to end, or something like
that, i got confused and just made sure i edited what was up there.
If your ISP requires you to use port 587 w/esmtp you will need to add this two lines as well
(after the above is a good spot)
define(`RELAY_MAILER',`esmtp')dnl
define(`RELAY_MAILER_ARGS',`TCP $h 587')dnl
Now, safe your file, Press CTRL+X, Enter, and "Y"
Step 5)
Now, if your ISP requires you to authentication your self, you will need to do this step.
re-open the sendmail.mc file for editing.
nano -w /etc/mail/sendmail.mc
find the line:
dnl # define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
remove the dnl # as some ISPS will need the additonal auth methods.
Now, save your file, Press CTRL+X, Enter, and "Y"
now, edit your access file
nano -w /etc/mail/access
you will need to add this:
AuthInfo:smtp.your.provider "U:username" "P:password"
changgin smtp.your.provider / username/password
Save (CTRL+X,"Y",<cr>)
Step 6)
you are done editing your sendmail configurations.
compile the changes by executing make: make -C /etc/mail
and now, restart sendmail by issuing the service sendmail restart command.
Step 7)
Testing!
Type:
mail -s Your Subject your@email.addy.com<cr>
yadadadadada<cr>
.<cr>
Cc: <cr>
the "." signifies end of email.
Wait a bit, and check to see if you got mail! (check your junk mail box, as it will come from a bad sender name such as root@localhost.localdomain)
Optional Step 8)
Want all that "root" mail to goto your email address?
create an alias for root!
nano -w /etc/alias
find: #root marc
or just add:
root <tab><tab> root, your@email.addy.com
Save (CTRL+X,"Y",<cr>)
Now reload the aliases by typing newaliases , it will spurt out some numbers, and you should be good togo..
(if you send a message to root, your should get it) ie, mail -s hi! root , etc,etc.
I have done my best to document this, and so far for my ISP this is the steps I had to take. If you not any changes send me an email @ KI4SWY at someplace called gmail with a dot and a com.
for users having to masq the servername/sender address please read:
http://www.waterlovinghead.com/SendmailMailFrom

