Home > Back-end >  Cannot properly send email in MacOS via postfix
Cannot properly send email in MacOS via postfix

Time:06-26

Telling story short. My MacOS version is: 12.4.

In /etc/postfix/:

In sasl_passwd i have:

smtp.emailsrvr.com:587 <myEmail>:<password> 

In main.cf i have:

# custom POSTFIX email sender config
relayhost = smtp.emailsrvr.com:587
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_mechanism_filter = plain
# also tried AUTH LOGIN in the line above
smtp_sasl_security_options =
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source = dev:/dev/urandom

My default DNS in network settings is 8.8.8.8 - standart Google DNS.

I did the postmap(ing) of my sasl_passwd, postfix reloading… At first time after sending emails via:

sudo echo "testing testing test email" | mail -s test <someTargetEmail>

i got SASL Authorization error, when used in sasl_passwd my gmail account.

Then found info about need to enable in gmail account something like "ACCESS OF ANOTHER SOURCES" kinda. Then changed my origin email from sasl_passwd to another one from @bk.ru domain.

After again redoing/restarting things finally when i send email - no error occured, i got the email id and description in mailq:

"-Queue ID-  --Size-- ----Arrival Time---- -Sender/Recipient-------
B7BD6301AB98DC*     305 Fri Jun 17 23:23:49  [email protected]
                                         <targetEmail>"

But no message was found in the targetEmail account everywhere. Can someone help me understand the situation and resolve the problem, thanx.

CodePudding user response:

Finally i resolved it by my own.


I added/edited in my custom settings in …main.cf here this:

mydomain = localhost
myorigin = $mydomain
smtp_sasl_security_options = noanonymous
inet_protocols = ipv4

In Google Gmail account added side app passwords and 2-factor auth. connected generated password in sasl_passwd.

In mailq sometimes mails were stucked or left in a second, but not have been received yet. Once problem was in sender verification, then with ipv6, and empty security options. Redoing then postmaping and reloading postfix then have done the job right, all of a sudden everything started to work.

AND found very useful info here

  • Related