本文整理汇总了PHP中emailer::sendEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP emailer::sendEmail方法的具体用法?PHP emailer::sendEmail怎么用?PHP emailer::sendEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emailer
的用法示例。
在下文中一共展示了emailer::sendEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
<?php
//Include Libraries for SendGrid
include "../Libraries/email/SendGrid.php";
include "../Libraries/email/SendGrid/Email.php";
//Capture variables from Form Sender
$to = $_POST['to'];
$from = $_POST['from'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$cc = $_POST['cc'];
//Split email list into an array
$to = explode(";", $to);
//Send The emails to each individual in the list
for ($x = 0; $x < count($to); $x++) {
emailer::sendEmail($to[$x], $from, $subject, $message, $cc);
}
//Echo a complete statement once its done
echo "complete";
//Emailer class
class emailer
{
static function sendEmail($to, $from, $subject, $message, $cc)
{
//User credentials
$sendgrid_username = "atushabe";
$sendgrid_password = "atushabe123";
//Set SendGrid Parameters
$sendgrid = new SendGrid($sendgrid_username, $sendgrid_password, array("turn_off_ssl_verification" => true));
//instantiate library class
$email = new SendGrid\Email();