Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions about professional server or networking-related infrastructure administration on Stack Overflow. You can edit the question so it’s on-topic for Stack Overflow. Closed 8 years ago. Improve this question
When I searched for configuring sendmail on ubuntu I din't get any clear answer, each of them assume I know what they are talking about,
I just want basic configuration to enable email sending, basically I will use it with google app engine to enable mail sending from dev server.
I already did this:
sudo apt-get install sendmail
then
sudo sendmailconfig
but I don't know what the last one actually did.
sendmail
is obsolete (there are much better alternatives!), my comment FIVE YEARS ago was simply about the fact that we do not migrate questions that old to another SE site.
When you typed in sudo sendmailconfig
, you should have been prompted to configure sendmail.
For reference, the files that are updated during configuration are located at the following (in case you want to update them manually):
/etc/mail/sendmail.conf
/etc/cron.d/sendmail
/etc/mail/sendmail.mc
You can test sendmail to see if it is properly configured and setup by typing the following into the command line:
$ echo "My test email being sent from sendmail" | /usr/sbin/sendmail myemail@domain.example
The following will allow you to add smtp relay to sendmail:
#Change to your mail config directory:
cd /etc/mail
#Make a auth subdirectory
mkdir auth
chmod 700 auth
#Create a file with your auth information to the smtp server
cd auth
touch client-info
#In the file, put the following, matching up to your smtp server:
AuthInfo:your.isp.net "U:root" "I:user" "P:password"
#Generate the Authentication database, make both files readable only by root
makemap hash client-info < client-info
chmod 600 client-info
cd ..
Add the following lines to sendmail.mc, but before the MAILERDEFINITIONS
. Make sure you update your smtp server.
define(`SMART_HOST',`your.isp.net')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash -o /etc/mail/auth/client-info.db')dnl
Invoke creation sendmail.cf (alternatively run make -C /etc/mail
):
m4 sendmail.mc > sendmail.cf
Restart the sendmail daemon:
service sendmail restart
I got the top answer working (can't reply yet) after one small edit
This did not work for me:
FEATURE('authinfo','hash /etc/mail/auth/client-info')dnl
The first single quote for each string should be changed to a backtick (`) like this:
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
After the change I run:
sudo sendmailconfig
And I'm in business :)
Combine two answers above, I finally make it work. Just be careful that the first single quote for each string is a backtick (`) in file sendmail.mc.
#Change to your mail config directory:
cd /etc/mail
#Make a auth subdirectory
mkdir auth
chmod 700 auth #maybe not, because I cannot apply cmd "cd auth" if I do so.
#Create a file with your auth information to the smtp server
cd auth
touch client-info
#In the file, put the following, matching up to your smtp server:
AuthInfo:your.isp.net "U:root" "I:user" "P:password"
#Generate the Authentication database, make both files readable only by root
makemap hash client-info < client-info
chmod 600 client-info
cd ..
#Add the following lines to sendmail.mc. Make sure you update your smtp server
#The first single quote for each string should be changed to a backtick (`) like this:
define(`SMART_HOST',`your.isp.net')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
#run
sudo sendmailconfig
AuthInfo:smtp.gmail.com "U:username" "P:password"
AuthInfo: smtp.gmail.com "U:yourusername@gmail.com" "P:yourpassword"
Success story sharing
your.isp.net
, do I putgmail.com
orsmtp.gmail.com
in there?sendmail.mc
file need to be in the form BACKTICK + your text + SINGLE QUOTE.