0

I want to send this mail without using PHPMailer But I need to use smtp authentication.

Here is my code

config.php

function reg_verify($code, $email)
{   $subject = "Your Verification Code At example.com";
    $message = "Your Verification Code is <b>".$code."</b>";
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
    $headers .= 'From: <admin@example.com>' . "\r\n";
    mail($email, $subject, $message, $headers);
    return $code;
}

register.php

$code = reg_verify("Ycd4123", "user@example.com");

Can I do it from ini_set()

nxt
  • 406
  • 2
  • 13
  • 1
    Does this answer your question? [Sending email with PHP from an SMTP server](https://stackoverflow.com/questions/14456673/sending-email-with-php-from-an-smtp-server) – Andrea Olivato Jul 25 '21 at 09:03
  • Apart from the first answer (PHPMailer) all other answers are alternatives that can work – Andrea Olivato Jul 25 '21 at 09:03
  • I tried to use the ini_set() method in [Here](https://stackoverflow.com/questions/14456673/sending-email-with-php-from-an-smtp-server) But it Returns a error ```Warning: mail(): SMTP server response: 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1)``` – nxt Jul 25 '21 at 09:29

0 Answers0