0

I'm setting my server to send mail through me gmail account but fails. I followed steps to set it up but I could not solve this problem.

I get the message "has a new email in var / www / root. And this text is displayed here, basically tells me that the authentication is required. Check this error in several replies in this forum and it said that my account gmail, was to give permits for less secure apps, which is activated it still does not work and I get this error.

    Final-Recipient: RFC822; mymail@gmail.com
    Action: failed
    Status: 5.5.1
    Diagnostic-Code: SMTP; 530-5.5.1 Authentication Required. Learn more at
    Last-Attempt-Date: Wed, 4 May 2016 16:36:54 GMT

My sendmail.mc

define(`SMART_HOST',`[smtp.gmail.com]')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash -o /etc/mail/authinfo/gmail-auth.db')dnl
define(`_USE_ETC_MAIL_')dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`$Id: sendmail.mc, v 8.15.2-3 2015-12-10 18:02:49 cowboy Exp $')
OSTYPE(`debian')dnl
DOMAIN(`debian-mta')dnl

gmail-auth contain

AuthInfo: "U:root" "myaccount@gmail.com" "P:12345678"

If someone could help me, I am very new to these servers, try PHPMailer but it was the same problem with GMAIL authentication.

hateful
  • 141
  • 2
  • 13
  • Have you tried using your user instead of root, I know for example you can't launch chrome as root. http://stackoverflow.com/questions/12258086/how-do-i-run-google-chrome-as-root Probably a similar underlying reason. – kpie May 04 '16 at 16:52
  • Have you compiled autinfo file using `makemap` program? Sendmail uses its "compiled" version. `-o` in FEATURE(authinfo) makes sendmail "ignore" missing "compiled" authinfo. – AnFi May 04 '16 at 17:14
  • @AndrzejA.Filip That will not do, as befriends if you could help me? with routes? – hateful May 04 '16 at 19:27
  • @hateful Could you post debug output generated by the test procedure in "the first answer"? There a few possible causes, it is important to narrow "possible causes" list. – AnFi May 06 '16 at 08:04

1 Answers1

0

Sendmail: debugging SMART_HOST with SMTP AUTH

As root send a test message with tracking SMTP session and tracking maps/authinfo lookups.
It usually locates problem or greatly shortens list of possible troublemakers.
(I think I remember "a few usual suspects"). (edited)

#!/bin/sh
# change RECIPEINT and SENDER addresses
RECIPIENT=jd@example.net
SENDER=jd@example.org

# -Am - send directly (by default email would go to 127.0.0.1:25)
# -v - turn on verbose mode (smtp tracking)
# -d60.5 - tracking maps (including authinfo) lookups

/usr/sbin/sendmail -Am -d60.5 -v -i -f$SENDER -- $RECIPIENT <<END
Subject: test
From: $SENDER
To: $RECIPIENT    

test!
END
bhlowe
  • 418
  • 4
  • 8
AnFi
  • 10,493
  • 3
  • 23
  • 47