i tried to use mailer package but its not supporting web , also i tried xampp send mail with gmail smtp but it gives me error : mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. any solution ?
<?php
$to_email = '[email protected]';
$subject = "change pw";
$body = "pwppwpwpwp";
$headers = "From: [email protected]";
if (mail($to_email, $subject, $body, $headers))
{
echo "Email successfully sent to $to_email...";
}
?>
CodePudding user response:
Your server wants encrypted transmission which mail()
cannot offer (TLS stands for Transport Layer Security) In short, mail()
sucks and it sucks for ages. Not sure why this garbage is still in the language. It is very plain, dumb and usually useless function supporting nothing modern mail servers require or support. You always want to use literally anything available but mail()
i.e your framework's mailer class or PHPMailer instead.