Monday, May 13, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 6962  / 2 Years ago, sat, december 25, 2021, 10:06:57

When I attempt to install postfix on my home desktop system, I get a configuration dialog with the following options1:



  1. No configuration: Should be chosen to leave the current configuration unchanged.

  2. Internet site: Mail is sent and received directly using SMTP.

  3. Internet with smarthost: Mail is received directly using SMTP or by running a utility such as fetchmail. Outgoing mail is sent using a smarthost.

  4. Satellite system: All mail is sent to another machine, called a 'smarthost', for delivery.

  5. Local only: The only delivered mail is the mail for local users. There is no network.


My primary interest is to have a way for non-interactive programs running on my desktop (mostly daemons and cron jobs) to send notifications to my mobile phone (either to my current email address or to the SMS client on my mobile phone).


It would be very convenient if such notifications could also be sent locally to the root user, but this is a seconary requirement.


My desktop system connects to the internet through an ISP (Xfinity).




I suppose that option 1 is ruled out from the start.


The requirement to be able to send mail to my current (i.e. non-"local") email address rules out option 5.


This leaves options 2, 3 and 4, but I can't figure out from the descriptions above which I should pick.




EDIT: There's a typo (which, unfortunately, I can no longer fix) in the bounty description; where it says



...what exactly is the "internet site" referred to in option (1),...



should be



...what exactly is the "internet site" referred to in option (2),...





EDIT 2: After reading the first answer to my question, I realized that the bounty description I wrote is not explicit enough. In this description I give (fictitious but realistic) values for my email address, my ISP, and my hostname. I also request to avoid placeholder values like www.example.org. I put all these stipulations in the bounty description because I would like the answer to include a postfix config file for the use-case specified in the original question. I am sorry that I did not say this explicitly in the bounty description (though it is what I meant by "detailed instructions").




1 The descriptions of the various options are copied verbatim from the dialog.


More From » configuration

 Answers
4

A step-by-step guide to send email with postfix via Yahoo mail.


I am posting the (hopefully) complete guide to send email from Yahoo mail, as requested.
This guide is slightly different from what you need if using Gmail, as shown here, and possibly other servers as well, but this specificity is crucial to make it work.


Note: I have actually tested it, and successfully received email in my destination address.
It also works well with local (outgoing, incoming) addresses.


The two answers by Raffa (1, 2) and further comments helped me a lot.
But there was still significant reading and tinkering needed to make it work.



  1. Install postfix and other packages.


    $ sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules


  2. The configuration post-install will show up. If not, use $ sudo dpkg-reconfigure postfix. For the successive screens, use: 1. Satellite system (but perhaps irrelevant since you will modify the postfix configuration file later), 2. myubuntubox, 3. [smtp.mail.yahoo.com]:465, 4. root, 5 and following: leave the defaults.



  3. Enable your Yahoo account to interact with postfix, with an App password. This is a one-time password, which avoids leaving the Yahoo mail password in your PC.
    Go to https://login.yahoo.com/account/security , Account Security -> App Password and generate a password.
    You will have to use it later on.
    This works for sure if not using 2-step verification, and possibly with 2SV as well.


    Note that in Gmail "App Passwords can only be used with accounts that have 2-Step Verification turned on." (source).
    In this case, you will use the App password since postfix, as many other apps, is a "less secure app".



  4. Add the following lines to /etc/postfix/main.cf


    relayhost = [smtp.mail.yahoo.com]:465
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd_yahoo
    smtp_sasl_security_options = noanonymous
    smtp_sasl_auth_enable = yes
    smtp_use_tls = yes
    smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
    smtp_tls_wrappermode = yes
    smtp_tls_security_level = encrypt
    smtp_generic_maps = regexp:/etc/postfix/regex_map_yahoo

    If present in /etc/postfix/main.cf, comment line


    smtp_tls_security_level=may

    with an initial hash mark # to avoid a warning message.
    I am not posting the complete file. If you find issues with these instructions, please post feedback.



  5. Create/edit /etc/postfix/sasl_passwd_yahoo so it contains


    [smtp.mail.yahoo.com]:465    [email protected]:<password>

    <password> should be replaced by the generated App password.



  6. Use the following commands


    $ sudo chmod 0600 /etc/postfix/sasl_passwd_yahoo
    $ sudo postmap /etc/postfix/sasl_passwd_yahoo
    $ sudo touch /etc/postfix/regex_map_yahoo
    $ sudo chmod 0600 /etc/postfix/regex_map_yahoo
    $ sudo nano /etc/postfix/regex_map_yahoo
    <---- Creating/editing the file ---->
    $ sudo postmap /etc/postfix/regex_map_yahoo
    $ sudo systemctl restart postfix.service

    When creating/editing /etc/postfix/regex_map_yahoo, its contents should be


    /.+@myubuntubox/   [email protected]


  7. Send email with, e.g.


    $ echo "This is the body of an encrypted email" | mail -s "This is the subject line" [email protected]



[#1701] Saturday, December 25, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
wheance

Total Points: 314
Total Questions: 96
Total Answers: 112

Location: Benin
Member since Thu, Aug 12, 2021
3 Years ago
;