ChatGPT解决这个技术问题 Extra ChatGPT

sendmail: how to configure sendmail on ubuntu? [closed]

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.

@ThiefMaster are we not migrating questions to the appropriate SE sites any more?
This question is way too old to be migrated (and it already was so when I closed it).
None of these answers worked for me. I found this online article that works for me: daveperrett.com/articles/2013/03/19/…
@ThiefMaster define "too old" are you saying sendmail is obsolete? Think again.
@PJBrunetWhile I do think 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.

S
Stephen Ostermiller

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

when trying the last command I get this bash: My test email being sent from sendmail: No such file or directory
sorry, when you say your.isp.net, do I put gmail.com or smtp.gmail.com in there?
One thing that isn't clear is what replacements to make in AuthInfo:your.isp.net "U:root" "I:user" "P:password" Specifically, how do you replace U:root and I:user
In case anyone else is confused, the strings inside the sendmail.mc file need to be in the form BACKTICK + your text + SINGLE QUOTE.
This was the only configuration that worked perfectly for me: linuxconfig.org/configuring-gmail-as-sendmail-email-relay
b
brma

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 :)


Whether I use your fix or not, when I invoke service sendmail restart, I get fileclass: cannot open 'ATURE(authinfo,': No such file or directory
it's "FEATURE" not "ATURE", check your copy/paste
you have to paste it at a different location in the sendmail.cf (i put it just above mailer, but i still get no mail)
f
flyrain

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

I am still having problem to understand the line AuthInfo... Can you please give one example... ???
Example, my client-info has only one line, AuthInfo:smtp.gmail.com "U:username" "P:password"
Still with all those settings and AuthInfo i fall into SPAM list using smtp.gmail.com with existing account from google.admin AuthInfo: smtp.gmail.com "U:root" "I:name@domain.com" "P:password" also tried AuthInfo: smtp-relay.gmail.com "U:root" "I:name@domain.com" "P:password"
To clarify: AuthInfo: smtp.gmail.com "U:yourusername@gmail.com" "P:yourpassword"

关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now