Skip to content

Instantly share code, notes, and snippets.

@Alejandro-MartinG
Created October 22, 2018 17:31
Show Gist options
  • Select an option

  • Save Alejandro-MartinG/51b3c4b077299b1ac7a6c577281ab5d3 to your computer and use it in GitHub Desktop.

Select an option

Save Alejandro-MartinG/51b3c4b077299b1ac7a6c577281ab5d3 to your computer and use it in GitHub Desktop.

Revisions

  1. Alejandro-MartinG created this gist Oct 22, 2018.
    46 changes: 46 additions & 0 deletions ssmtp_email_conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    sudo apt-get install bsd-mailx

    sudo apt-get install ssmtp

    sudo vim /etc/ssmtp/ssmtp.conf

    I have added these lines in config file:

    # Config file for sSMTP sendmail
    TSL_CA_FILE=/etc/ssl/certs/ca-certificates.crt
    #
    # The person who gets all mail for userids < 1000
    # Make this empty to disable rewriting.
    [email protected]

    # The place where the mail goes. The actual machine name is required no
    # MX records are consulted. Commonly mailhosts are named mail.domain.com
    mailhub=smtp.gmail.com:587
    #mailhub=smtp.gmail.com:465
    [email protected]
    AuthPass=*******
    UseSTARTTLS=YES
    #UseTLS=YES

    # Where will the mail seem to come from?
    rewriteDomain=gmail.com

    # The full hostname
    hostname=instance-1

    # Are users allowed to set their own From: address?
    # YES - Allow the user to specify their own From: address
    # NO - Use the system generated From: address
    FromLineOverride=YES

    $ sudo vim /etc/ssmtp/revaliases
    root:[email protected]:smtp.gmail.com:587

    Turn on "less secure app access":
    https://myaccount.google.com/lesssecureapps

    You will recive a email talking about foreing login, accept it and its done you can receive emails:
    https://myaccount.google.com/device-activity/nt/1540227923000

    date | sudo ssmtp [email protected]