How can the error "SMTP server response: 553 We do not relay non-local mail, sorry" be resolved when using XAMPP on Windows?

The error "SMTP server response: 553 We do not relay non-local mail, sorry" occurs when the SMTP server does not allow relaying non-local mail. To resolve this issue, you need to configure your SMTP server to allow relaying for non-local mail. This can be done by updating the SMTP settings in your XAMPP configuration.

// Set the SMTP server settings
ini_set("SMTP", "your_smtp_server");
ini_set("smtp_port", "your_smtp_port");
ini_set("sendmail_from", "your_email_address");

// Send the email using the updated SMTP settings
mail("recipient@example.com", "Subject", "Message", "From: sender@example.com");