<?php
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: Jack Sparrow <jsparrow@blackpearl.com>' . PHP_EOL .
'Reply-To: Jack Sparrow <jsparrow@blackpearl.com>' . PHP_EOL .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
<?php
mail("recipient@example.com",
"This is the message subject",
"This is the message body",
"From: sender@example.com" . "
" . "Content-Type: text/plain; charset=utf-8",
"-fsender@example.com");
?>
<?php
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
require "vendor/autoload.php";
use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerSMTP;
$mail = new PHPMailer(true);
// $mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Host = "smtp.example.com";
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
$mail->Username = "you@example.com";
$mail->Password = "password";
$mail->setFrom($email, $name);
$mail->addAddress("dave@example.com", "Dave");
$mail->Subject = $subject;
$mail->Body = $message;
$mail->send();
header("Location: sent.html");
mail( to, subject, message, headers, parameters );
<?php
$url = 'https://api.elasticemail.com/v2/email/send';
try{
$post = array('from' => 'youremail@yourdomain.com',
'fromName' => 'Your Company Name',
'apikey' => '00000000-0000-0000-0000-000000000000',
'subject' => 'Your Subject',
'to' => 'recipient1@gmail.com;recipient2@gmail.com',
'bodyHtml' => '<h1>Html Body</h1>',
'bodyText' => 'Text Body',
'isTransactional' => false);
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $post,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_SSL_VERIFYPEER => false
));
$result=curl_exec ($ch);
curl_close ($ch);
echo $result;
}
catch(Exception $ex){
echo $ex->getMessage();
}
?>
mail ( string $to , string $subject , string $message [, mixed $additional_headers [, string $additional_parameters ]] ) : bool
mnjah