Editing main.cf
sudo vi /etc/postfix/main.cf.
mail_owner = _postfix
setgid_group = _postdrop
#Gmail SMTP
relayhost=smtp.gmail.com:587
# Enable SASL authentication in the Postfix SMTP client.
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options=noanonymous
smtp_sasl_mechanism_filter=plain
# Enable Transport Layer Security (TLS), i.e. SSL.
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
sudo vi /etc/postfix/sasl_passwd
smtp.gmail.com:587 your_email@gmail.com:your_password
sudo postmap /etc/postfix/sasl_passwd
start command - sudo postfix start
restart command - sudo postfix reload
Test the Email
<?php
$headers = 'From:sender name<sender@gmail.com>' . "\r\n" .
'Reply-To: sender@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
var_dump(mail('receiver_email@gmail.com', 'Test Subject Mac', 'Test Message Mac', $headers));
If you are facing any issues, please open a ticket at Support.