Mail send via Relay host on Ubuntu Server: Difference between revisions
From WikiMLT
mNo edit summary |
m Стадий: 1 [Фаза:Идентифициране, Статус:Създаване]; Категория:Linux Server |
||
Line 1: | Line 1: | ||
<noinclude><!--[[Category:Linux_Server|?]]-->{{ContentArticleHeader/Linux_Server}}</noinclude> | |||
== References == | |||
* ... | |||
* ... | |||
== Section 1 == | |||
... | |||
<noinclude>{{note|Source: | <noinclude>{{note|Source: | ||
* [https://superuser.com/a/280205/664884 SuperUser: How do I change postfix port from 25 to 587?] | * [https://superuser.com/a/280205/664884 SuperUser: How do I change postfix port from 25 to 587?] | ||
Line 42: | Line 51: | ||
sudo postmap /etc/postfix/sasl_passwd && sudo postfix reload | sudo postmap /etc/postfix/sasl_passwd && sudo postfix reload | ||
</syntaxhighlight></onlyinclude> | </syntaxhighlight></onlyinclude> | ||
<noinclude> | |||
<div id='devStage'> | |||
{{devStage | |||
| Прндл = Linux Server | |||
| Стадий = 1 | |||
| Фаза = Идентифициране | |||
| Статус = Създаване | |||
| ИдтПт = {{REVISIONUSER}} | |||
| ИдтДт = {{Today}} | |||
| ИдтРв = {{REVISIONID}} | |||
}} | |||
</div> | |||
</noinclude> |
Revision as of 11:34, 1 August 2022
References
- …
- …
Section 1
…
Source:
- SuperUser: How do I change postfix port from 25 to 587?
- Note: With this configuration, all mail must be sent using your Gmail address as "From", unless you have setup your Gmail (Settings>Accounts and Import>) to "Send mail as" some other, then you cold use these email addresses.
Edit /etc/postfix/main.cf
as follow.
sudo nano /etc/postfix/main.cf
#Apply
# This tells Postfix to hand off all messages to Gmail, and never do direct delivery.
relayhost = [smtp.gmail.com]:587
# This enables TLS (SMTPS) certificate verification, because Gmail has a valid one.
smtp_tls_security_level = verify
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_tls_session_cache_database = btree:/var/run/smtp_tls_session_cache
# This tells Postfix to provide the username/password when Gmail asks for one.
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
In /etc/postfix/sasl_passwd
, add your Gmail username and password.
sudo nano /etc/postfix/sasl_passwd
#Apply
[smtp.gmail.com]:587 user-name@gmail.com:app-password
# Note you must setup App Password at https://myaccount.google.com/u/0/apppasswords
Compile the sasl_passwd
file into a database and reload Postfix's main configuration.
sudo postmap /etc/postfix/sasl_passwd && sudo postfix reload