PHP

HOW TO SEND EMAIL IN PHP

SUPER SIMPLE PHP MAIL

01

echo mail("JON@DOE.COM", "SUBJECT", "MESSAGE") ? "OK" : "ERROR" ;

SET MAIL DATA $to = "jon@doe.com"; $subject = "Test"; $message = "Test message."; $header = implode("\r\n", [   "MIME-Version: 1.0",   "Content-type: text/plain;charset=utf-8",   "From: NAME <you@mail.com>",   "Cc: joe@doe.com",   "Bcc: joy@doe.com" ]);

NATIVE PHP MAIL WITH CC BCC

02

SEND! echo mail($to, $subject, $message, $header) ? "OK" : "ERROR" ;

SET MAIL DATA $mail = new PHPMailer; $mail->setFrom("you@mail.com"); $mail->addAddress("jon@doe.com"); $mail->addCC('joe@doe.com'); $mail->addBCC('joy@doe.com'); $mail->Subject = "Test"; $mail->Body = "Test message.";   SEND! echo $mail->send()   ? "Sent"  : "Error" . $mail->ErrorInfo ;

PHP MAILER LIBRARY

03