LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Sendmail to use Gmail's SMTP to send mail (http://www.linuxquestions.org/questions/linux-software-2/sendmail-to-use-gmails-smtp-to-send-mail-874471/)

lpallard 04-11-2011 08:39 PM

Sendmail to use Gmail's SMTP to send mail
 
Hi there!

I am trying to configure sendmail to use GMail to send emails. I followed the instructions at http://www.phinesolutions.com/sendma...lay-howto.html but it failed.

After I was done with these instructions, I think I "cooked" sendmail... Can no longer configure it and it seems that I will have to start from scratch again...

Anybody can provide direction? How to get sendmail to send emails using Gmail's SMTP server?

Thanks!

acid_kewpie 04-12-2011 04:41 PM

The link you provided looks great and appears to work well. I don't understand what else we are supposed to say..?

lpallard 04-12-2011 04:50 PM

Well I should have been more descriptive....

Like i said, I followed the instructions at that link, but for some reasons, it no longer works. I am trying to send an email using a python script somebody put together, and before I tried to modify sendmail, the emails were at least created, but could not be delivered (due to the misconfiguration and not using Gmail's smtp). At least, I could see them as "Deferred" in root's inbox. I am using Webmin to manage my server and see the inboxes.

Now since I tried to modify sendmail to use Gmail's smtp servers, I no longer can access sendmail's config page (in Webmin) nor I can see root's inbox. I also dont receive the emails so this means that they are not sent. When I try to access sendmail's config page in webmin, it says:

Quote:

Your sendmail config file does not appear to be for the latest sendmail version. Webmin only supports versions 8.8 and above.
Sendmail.cf has this in it (looks rather incomplete to me...)

Quote:

FEATURE('authinfo','hash /etc/mail/auth/client-info.db')












TRUST_AUTH_MECH('EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')
Thats what I mean by "cooked" What should I do?

Thanks!

lpallard 04-26-2011 09:14 PM

Bump.. Anybody?

Anybody configured sendmail to use an external email server to send email?? Cant believe Im the only one to have tried this...

acid_kewpie 04-27-2011 02:04 AM

Well I'd certainly steer clear of webmin for anything at all. I'd also personally steer clear of sendmail as it's ancient and complicated compared to, for example, Postfix. You're never going to get anywhere using webmin errors to base a diagnosis on, what actually happens in the mail logs? Does sendmail start? Is that all that is in the cf file?? What about the sendmail.mc?

lpallard 04-27-2011 04:49 AM

Well in light of your reply I think the best course of action is to ignore webmin for what it says and delete the config files of sendmail and restart fresh. What happens I think is somehow the procedure I followed was either flawed or I screwed up doing it (more likely to be this one) and resulted in an incomplete config file.

So if I get this straight, you're recommending to get away from sendmail for the default system email client? As for webmin you also recommend staying away from it? I use webmin on my server to have all features and info available in the same location and be able to remotely control them. Do you have a suggestion for a better replacement?

acid_kewpie 04-27-2011 05:32 AM

Sendmail is still the most prolific SMTP server on the web, and it's extremely good, it's just complicated and obscure - I mean, it has a config file to manage the config file!

I would never want to use an all-in-one tool for management like that. I wold rather know the actual products I'm using. SSH works well for me.

EDDY1 04-27-2011 09:26 AM

You have to enable smtp at gmail account.
Go to gmail settings and enable forwarding POP IMAP

lpallard 04-30-2011 02:09 PM

OK after a few weeks off the keyboard, I am coming back to this topic.

I've restarted from scratch and completely ignoring webmin this time. Here's where I think the problem is:

My sendmail.mc file is:


Code:

FEATURE(`authinfo',`hash /etc/mail/auth/client-info.db')dnl
define(`SMART_HOST',`smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS',`TCP $h 587')
define(`ESMTP_MAILER_ARGS',`TCP $h 587')
define(`CERT_DIR',`/etc/mail/certs')
define(`confCACERT_PATH',`CERT_DIR')
define(`confCACERT',`CERT_DIR/ca-bundle.crt')
define(`confCRL',`CERT_DIR/ca-bundle.crt')
define(`confSERVER_CERT',`CERT_DIR/sendmail.pem')
define(`confSERVER_KEY',`CERT_DIR/sendmail.pem')
define(`confCLIENT_CERT',`CERT_DIR/sendmail.pem')
define(`confCLIENT_KEY',`CERT_DIR/sendmail.pem')
define(`confAUTH_MECHANISMS',`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')

Now I know m4 used to generate the sendmail.cf file is sensitive to the stupid quote marks... Are they all OK? No syntax errors there???

Then I used

m4 sendmail.mc > sendmail.cf

and got a sendmail.cf file with this in it:

Code:

FEATURE(authinfo,hash /etc/mail/auth/client-info.db)










TRUST_AUTH_MECH(EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN)

Like I said, it looks incomplete to me...

THen I restarted the sendmail daemon and got this output:
Code:

root@server:/etc/mail# /etc/rc.d/rc.sendmail start
Starting sendmail MTA daemon:  /usr/sbin/sendmail -L sm-mta -bd -q25m
451 4.0.0 /etc/mail/sendmail.cf: line 1: fileclass: cannot open 'ATURE(authinfo,hash': No such file or directory
554 5.0.0 No local mailer defined
554 5.0.0 QueueDirectory (Q) option must be set
Starting sendmail MSP queue runner:  /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m

Then I tested sendmail with

mail email@domail.com and entering subject/text body and pressing Crtl+D but I never gor the email.

So this confirms that something is wrong. Whats the problem?

Thanks!

bathory 04-30-2011 04:10 PM

Quote:

451 4.0.0 /etc/mail/sendmail.cf: line 1: fileclass: cannot open 'ATURE(authinfo,hash': No such file or directory
I don't see something wrong in the .mc file, but looks line there is an error at the beginning(maybe some not printed characters), so the resulting .cf is bungled.
Take a look at this howto
, here at LQ (just the "Client-Side SMTP AUTH + SMART_HOST" section) to recreate a correct .mc file

Regards

lpallard 05-01-2011 10:58 AM

OK I got past the last point where I was, now I have a decent sendmail.cf file... but I still cant send mails. I have this in my /var/log/maillog:

Quote:

May 1 11:57:10 server sendmail[9707]: p41FvAZh009707: from=root, size=224, class=0, nrcpts=1, msgid=<201105011557.p41FvAZh009707@server.localdomain>, relay=root@localhost
May 1 11:57:10 server sm-mta[9708]: p41FvART009708: from=<root@server.localdomain>, size=467, class=0, nrcpts=1, msgid=<201105011557.p41FvAZh009707@server.localdomain>, proto=ESMTP, daemon=M$
May 1 11:57:10 server sendmail[9707]: p41FvAZh009707: to=email@gmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30224, relay=[127.0.0.1] [127.0.0.1],$
May 1 11:57:11 server sm-mta[9710]: STARTTLS=client, relay=smtp.gmail.com, version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128
May 1 11:57:11 server sm-mta[9710]: p41FvART009708: to=<email@gmail.com>, ctladdr=<root@server.localdomain> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=120467, relay=smt$
May 1 11:57:11 server sm-mta[9710]: p41FvART009708: p41FvBRT009710: DSN: Service unavailable
May 1 11:57:11 server sm-mta[9710]: p41FvBRT009710: to=<root@server.localdomain>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31682, dsn=2.0.0, stat=Sent
As you can see, the 4th line has

version=TLSv1/SSLv3, verify=FAIL

that is probably why it doesn't work. Anybody would know what could be wrong?

bathory 05-01-2011 11:48 AM

This is not an error. The problem is
Quote:

May 1 11:57:11 server sm-mta[9710]: p41FvART009708: p41FvBRT009710: DSN: Service unavailable
This is because gmail does not accept auth on smtp port 25, but on submission port 587. Take a look here to see what you need to change

Regards

lpallard 05-01-2011 01:05 PM

I finally got it to work!! The instructions at http://www.phinesolutions.com/sendma...lay-howto.html were either incomplete or not meant to be implemented on a slackware machine, I am no Sendmail expert to comment ion that but I used the instructions of http://www.linuxha.com/other/sendmail/gmail.html and with small modifications such as ISP name and file names, it works perfectly!

Thanks to all!!!!


All times are GMT -5. The time now is 03:39 AM.