ansible playbook able to send mail via mutt mail

342 Views Asked by At

here is my local .muttrc (without names/passwords as XXXX...)

set ssl_starttls=no
set ssl_force_tls=no

set [email protected]
set imap_pass=XXXXXXXXX

set [email protected]
set realname=XXXXXXXX

set folder=imaps://imap.gmail.com/
set spoolfile=imaps://imap.gmail.com/INBOX
set postponed=imaps://imap.gmail.com/[Gmail]/Drafts

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

set smtp_url=smtps://[email protected]@smtp.gmail.com:465/
set smtp_pass=XXXXXXXXX

set move=no
set imap_keepalive=5000

for testing here is the ansible task associated

[...]
    - name: send mail to user
        shell : |
          chmod 777 /tmp/poid.png
          set from ="ansible XXXXXXXX"
          set realname = "XXXXXXXX"
          echo $(date +%Y%m%d)|mutt -e 'unset record' -x -s "Analyse Regime $(date +%Y%m%d-%H:%M)" [email protected] -a /tmp/poid.png --
[...]

the error messages I got is

STDOUT:

Impossible d'envoyer le message. 


STDERR:

L'authentification SASL a échoué

Sorry here messages are in french but you guess authentification failed & impossible to send the message

in logs I have in loop from mail.info

Jul 19 02:48:21 XXXXXXX smtpd[559461]: smtp-out: Enabling route [] <-> [2a00:1450:400c:c08::1a] (wq-in-x1a.1e100.net)
Jul 19 02:48:21 XXXXXXX smtpd[559461]: f34821c26d54d72c mta connecting address=smtp://[2a00:1450:400c:c08::1a]:25 host=wq-in-x1a.1e100.net
Jul 19 02:50:11 XXXXXXX smtpd[559461]: f34821c17e1ee80f mta error reason=Connection timeout
Jul 19 02:50:11 XXXXXXX smtpd[559461]: smtp-out: Disabling route [] <-> 74.125.140.27 (wq-in-f27.1e100.net) for 15s
Jul 19 02:50:26 XXXXXXX smtpd[559461]: smtp-out: Enabling route [] <-> 74.125.140.27 (wq-in-f27.1e100.net)
Jul 19 02:50:26 XXXXXXX smtpd[559461]: f34821c3c4056343 mta connecting address=smtp://74.125.140.27:25 host=wq-in-f27.1e100.net
Jul 19 02:50:31 XXXXXXX smtpd[559461]: f34821c26d54d72c mta error reason=Connection timeout
Jul 19 02:50:31 XXXXXXX smtpd[559461]: smtp-out: Disabling route [] <-> [2a00:1450:400c:c08::1a] (wq-in-x1a.1e100.net) for 15s
Jul 19 02:50:46 XXXXXXX smtpd[559461]: smtp-out: Enabling route [] <-> [2a00:1450:400c:c08::1a] (wq-in-x1a.1e100.net)
Jul 19 02:50:51 XXXXXXX smtpd[559461]: f34821c428b472b5 mta connecting address=smtp://[2a00:1450:400c:c08::1a]:25 host=wq-in-x1a.1e100.net

in mail.log

Jul 19 02:48:21 XXXXXXX smtpd[559461]: smtp-out: Enabling route [] <-> [2a00:1450:400c:c08::1a] (wq-in-x1a.1e100.net)
Jul 19 02:48:21 XXXXXXX smtpd[559461]: f34821c26d54d72c mta connecting address=smtp://[2a00:1450:400c:c08::1a]:25 host=wq-in-x1a.1e100.net
Jul 19 02:50:11 XXXXXXX smtpd[559461]: f34821c17e1ee80f mta error reason=Connection timeout
Jul 19 02:50:11 XXXXXXX smtpd[559461]: smtp-out: Disabling route [] <-> 74.125.140.27 (wq-in-f27.1e100.net) for 15s
Jul 19 02:50:26 XXXXXXX smtpd[559461]: smtp-out: Enabling route [] <-> 74.125.140.27 (wq-in-f27.1e100.net)
Jul 19 02:50:26 XXXXXXX smtpd[559461]: f34821c3c4056343 mta connecting address=smtp://74.125.140.27:25 host=wq-in-f27.1e100.net
Jul 19 02:50:31 XXXXXXX smtpd[559461]: f34821c26d54d72c mta error reason=Connection timeout
Jul 19 02:50:31 XXXXXXX smtpd[559461]: smtp-out: Disabling route [] <-> [2a00:1450:400c:c08::1a] (wq-in-x1a.1e100.net) for 15s
Jul 19 02:50:46 XXXXXXX smtpd[559461]: smtp-out: Enabling route [] <-> [2a00:1450:400c:c08::1a] (wq-in-x1a.1e100.net)
Jul 19 02:50:51 XXXXXXX smtpd[559461]: f34821c428b472b5 mta connecting address=smtp://[2a00:1450:400c:c08::1a]:25 host=wq-in-x1a.1e100.net

what I have already tested :

  • starttls=yes
  • force_tLS=yes
  • use of 465 & any other known good values for TLS or SSL
  • reading all old messages from here or https://unix.stackexchange.com around it
  • change my password to be sure I use the good one
  • see logs

the error realy seems to be muttrc side as I cannot sent messages by same command in shell ...

0

There are 0 best solutions below