На macOS установил
Postfix. Прописал конфиг>
main.cf:
compatibility_level = 2
queue_directory = /private/var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = _postfix
unknown_local_recipient_reject_code = 550
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = _postdrop
html_directory = /usr/share/doc/postfix/html
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix/examples
readme_directory = /usr/share/doc/postfix
inet_protocols = all
# Apple Defaults
#
message_size_limit = 10485760
mailbox_size_limit = 0
biff = no
mynetworks = 127.0.0.0/8, [::1]/128
smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated permit
recipient_delimiter = +
tls_random_source = dev:/dev/urandom
smtpd_tls_ciphers = medium
# Use Gmail SMTP
relayhost = smtp.gmail.com:587
smtp_sasl_mechanism_filter = plain
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_security_level = encrypt
tls_random_source = dev:/dev/urandom
И вот
php.ini[mail function]
SMTP = localhost
smtp_port = 25
sendmail_from = me@example.com
sendmail_path = /usr/sbin/sendmail -t -i -fno-reply@wartur.ru
SMTP=localhost
smtp_port=25
sendmail_path = "env -i /usr/sbin/sendmail -t -i"
Скрипт ничего не отправляет
mail(
"",
"",
"Message",
join("\r\n", [
"From: Почтовый робот <somebody@mail.ru>",
"To: eartem56@gmail.com",
"Subject: Добрый день!",
"Content-type: text/plain; charset=utf-8"
])
);