Mail from PHP or some other web based mail.

Discussion in 'Programming' started by OutcastChris, Jun 11, 2018.

  1. What is the best way to send an email from a Script? Having an issue with mine currently where it is not sending.

    Code (Text):
    $to      = $email;
            $subject = 'Account Verification Code';
            $message = 'Code: '. $code . "\r\n" . 'Please Verify here';
            $headers = 'From: [email protected]';
            mail($to, $subject, $message, $headers);
    or is there another more efficient system?
  2. An easy way is using PHPMailer, you should use Composer to install it.
    And if you don't want to use any library than the code not work because you not configure the SMTP server
  3. That might be true but don't have to.

    If you want to use the default mail-function, you could use a class like this: