What are the best practices for configuring the SMTP and smtp_port settings in php.ini for sending emails through an external server?

When configuring the SMTP and smtp_port settings in php.ini for sending emails through an external server, it is important to ensure that the correct SMTP server address and port number are specified. Additionally, it is recommended to use secure protocols such as SSL or TLS to encrypt the communication with the SMTP server for improved security.

[mail function]
SMTP = smtp.yourserver.com
smtp_port = 587
sendmail_from = your@email.com
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"