Code Monkey home page Code Monkey logo

ansible-msmtp-mailer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ansible-msmtp-mailer's Issues

Update code on Galaxy

@chriswayg Thanks for getting those PRs in, notably #5. Would you kindly do an import on Galaxy to update the code there?

Last Commit: 2 years ago
Last Import: 2 years ago

I'm trying to unfork now that PRs have been merged and use your role directly from Galaxy, without having to submodule the repo. Thanks!

Version 1.8.11 Debian bulseyes

New Debian version 11 (bulseyes) includes a msmtp upgrade to version 1.8.11 (Debian 10 buster has 1.8.3 by default).

This new version (since 1.8.8) allows to replace From: header with set_from_header on parameter.

Could you please include this parameter in config?

Many thanks

Can you tag a release please?

I pin all of my ansible deps to a specific version and I'd like to do the same here. Any chance you could push a tag?

test fail feature: newline formatting and failed mail to root

I believe in the test mail, echo -e should be used for the newlines to be parsed properly.

Also, the test fail failed to go out through SES because it objected to the mail to root.

I guess that failed because I have msmtp_alias_root set up, so the mail is attempted to be forwarded through the smtp server, but the email address was left as only root, I'm not sure which component is at fault there, but I would just remove root as one of the test addresses, since msmtp is all about sending remote mail.

Option to send mail to local addresses, like "root" or "cron"

Some Linux utilities will send mail from a local address with no @ sign, like "cron" , to a local email address like "root" (again, no "@" sign or domain).

While msmtp has features to alter the envelope sender and recipient, it doesn't alter the "To:" or "From:" message itself.

When the Envelope doesn't match these details, it can be considered spam. AWS SES is an example of an SMTP service that won't accept mail addressed to "root", even if the Envelope recipient is valid. But sending out cron mails is exactly the kind of thing that msmtp should be good for!

One issue about this in the msmtp bug tracker is here:
marlam/msmtp#98

So I propose that the Ansible role introduce a small feature to address, since the msmtp maintainer considers it out of scope.

I successfully tested the solution of adding my own sendmail wrapper. In my case, I hard-coded an email address to use, but a proper solution could use a template variable and a variable for this:

#!/usr/bin/sh
# If either the "From" or "To" contain a bare local address like just "root"
# Then rewrite that to be [email protected]
# This feature is missing from msmtp.
# Ref: https://github.com/marlam/msmtp-mirror/issues/98
sed -e '/From:[^@]*$/ s/From:.*$/From: [email protected]/;/To:[^@]*$/ s/To:.*$/To: [email protected]/;' | /usr/bin/msmtp $@

Then in Ansible:

- name: Install mstmp wrapper to fix local addresses
  tags: mail
  ansible.builtin.copy:
    src: usr/local/sbin/sendmail
    dest: /usr/local/sbin/sendmail
    # Must be setuid
    mode: "u+rwx,g=sr,o=x"
    group: msmtp

I tested this with the mail app (mailx) on Ubuntu 22. It relies on clients looking up sendmail in $PATH. If some place has hardcoded the path to /usr/sbin/sendmail, my fix wouldn't cover that since I don't replace that file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.