本文整理汇总了PHP中Mailer::setFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::setFrom方法的具体用法?PHP Mailer::setFrom怎么用?PHP Mailer::setFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::setFrom方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfiguredMailer
public function getConfiguredMailer()
{
if (!$this->mailer_config) {
throw new Exception('MailerBlast needs to have the mailer configured.');
}
$mlr = new Mailer();
foreach ($this->mailer_config as $k => $v) {
switch ($k) {
case 'cc':
$mlr->addCc($v);
break;
case 'bcc':
$mlr->addBcc($v);
break;
case 'from':
$mlr->setFrom($v);
break;
case 'replyto':
$mlr->setReplyTo($v);
break;
case 'subject':
$mlr->setSubject($v);
break;
case 'content-type':
$mlr->setContentType($v);
break;
case 'headers':
$mlr->headers .= $v;
break;
default:
break;
}
}
return $mlr;
}
示例2: Mailer
?>
</label>
<input name="kamer" type="text"/>
</div>
<input type="submit" value="<?php
echo $taal->msg('versturen');
?>
"/>
</fieldset>
</form>
<?}
else{
$mailer = new Mailer();
$mailer->setHTMLCharset("UTF-8");
$mailer->setFrom($_POST['email']);
$mailer->setCc($_POST['email']);
$mailer->setSubject("adreswijziging");
$mailer->setText("Beste,\n\nIs het mogelijk van de kotadres gegevens van de volgende student aan te passen?\n\n".$_POST['voornaam']." ".$_POST['naam']."\nStudentennummer: ".$_POST['studnummer']."\nKotadres:\n".$_POST['home'].", kamernummer ".$_POST['kamer']."\n\n\n==========\nDeze e-mail werd gegenereerd door het Online Herstelformulier van de Afdeling Huisvesting");
$mailer->send(array("mesuerebart@gmail.com"));//helpdesk.studadmin@UGent.be
?>
<h1><?php
echo $taal->msg('adresaanpassen');
?>
</h1>
<p><?php
echo $taal->msg('adresaanpassen_submitted');
?>
</p>
<?} ?>
示例3: MySend
public static function MySend($array)
{
global $INI, $app;
if (isset($INI["mailserver"]) && $INI["mailserver"]) {
$mailer = new Mailer();
$mailer->isSMTP();
$mailer->SMTPOptions = ['ssl' => ['verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true]];
$mailer->Host = $INI["mailserver"];
if (isset($INI["maildebug"]) && $INI["maildebug"]) {
$mailer->SMTPDebug = 2;
}
if (isset($INI["mailuser"]) && $INI["mailuser"] && isset($INI["mailpwd"]) && $INI["mailpwd"]) {
$mailer->SMTPAuth = true;
$mailer->Username = $INI["mailuser"];
$mailer->Password = $INI["mailpwd"];
$mailer->Port = $INI["mailport"];
}
$mailer->isHTML(true);
if (is_array($array["from"])) {
$mailer->setFrom($array["from"][0], $array["from"][1]);
} else {
$mailer->setFrom($array["from"]);
}
if (is_array($array["to"])) {
$mailer->addAddress($array["to"][0], $array["to"][1]);
} else {
$mailer->addAddress($array["to"]);
}
if (isset($array["reply"])) {
if (is_array($array["reply"])) {
$mailer->addReplyTo($array["reply"][0], $array["reply"][1]);
} else {
$mailer->addReplyTo($array["reply"]);
}
}
if (isset($array["bcc"])) {
if (is_array($array["bcc"])) {
foreach ($array["bcc"] as $bcc) {
$mailer->addBCC($bcc);
}
} else {
$mailer->addBCC($array["bcc"]);
}
}
$mailer->Subject = $array["subject"];
$mailer->Body = $array["body"];
if (isset($array["attachments"])) {
foreach ($array["attachments"] as $a) {
$mailer->addAttachment($a);
}
}
$mailer->send();
} else {
if (isset($INI["maildebug"]) && $INI["maildebug"]) {
$file = fopen($app->basePathname("cache/debug.txt"), "a");
fwrite($file, "Sending to: " . join(" ; ", mklist($array["to"])));
fwrite($file, "\n{$array['body']}\n----------\n");
fclose($file);
}
}
}
示例4: Mailer
}
$beheerders = Personeel::getBeheerders();
foreach ($beheerders as $personeel) {
$mailer = new Mailer();
$mailer->setHTMLCharset("UTF-8");
$mailer->setFrom($from);
$homes = $personeel->getHomesLijst();
foreach ($homes as $home) {
$id = $home->getId();
if (isset($count[$id]) && ($count[$id] > 0)) {
// $personeel is homemanager van een home die een mail moet krijgen over $count[$id] ongeziene formulieren
$mailer->setSubject("[Herstelformulieren] ".$count[$id]." ongezien");
$mailer->setText("Beste,\n\nEr zijn sinds gisteren ".$count[$id]." herstelformulieren bijgekomen uit ".$home->getLangeNaam()." die nog bekeken moeten worden. Gelieve hiervoor in te loggen op https://chaos.ugent.be/test_herstelformulier/repair/index.php .");
//$mailer->send(array($personeel->getEmail()));
}
}
}*/
$beheerders = Personeel::getBeheerders();
foreach ($beheerders as $personeel) {
$mailer = new Mailer();
$mailer->setHTMLCharset("UTF-8");
$mailer->setFrom($from);
$aantal = sizeof(Herstelformulier::getPersoneelList($personeel->getHomeStringLijst(), new Status("ongezien")));
if ($aantal > 0 && $personeel->getMails()) {
$mailer->setSubject("[Herstelformulieren] " . $aantal . " ongeziene formulieren");
$mailer->setText("Beste,\n\nEr zijn " . $aantal . " ongeziene herstelformulieren uit de homes waarvoor u verantwoordelijk bent. Gelieve hiervoor in te loggen op https://herstelformulier.ugent.be .");
$mailer->send(array($personeel->getEmail()));
}
}
示例5: send_email
function send_email($email, $message)
{
require 'mailer.php';
try {
$mailer = new Mailer();
$mailer->setFrom("Paypal APP", "payement@yourwebsite.com");
$mailer->addRecipient('', $email);
$mailer->fillSubject('Your Paypal Payement Rrecieved');
$mailer->fillMessage($message);
$mailer->send();
} catch (Exception $e) {
echo $e->getMessage();
exit(0);
}
}
示例6: SendMail
/**
* Sendet eine Mail zu User
*
* @version 1.0
* @author Rolf Neef rolf.neef@onliehome.de
* @param String $sMail
* @return Array
*/
public function SendMail($sMail)
{
$oMail = new Mailer();
$oMail->setFrom("AI - Browsergame", "noreply@ai.de");
$oMail->addRecipient('You', $sMail);
$oMail->fillSubject("Deine Registrierung");
$oMail->fillMessage($this->sRegisterText);
$oMail->send();
return array('success' => 'true', 'message' => 'Sie haben eine Mail erhalten');
}
示例7: arguments
#!/usr/bin/php -q
<?php
require_once "lib/Misc.inc.php";
require_once "lib/Class.Mailer.inc.php";
$cli_args = arguments($argv);
$mai = new Mailer();
try {
switch ($cli_args['type']) {
case 'simple':
default:
$mai->setFrom("me", "my@mail");
$mai->setTo("None", "panos");
$mai->setSubject("Μία δοκιμή", "UTF-8");
$mai->body = new Mailer_TextBody("test test");
break;
case 'utf':
$mai->setFrom("Πάνος", "my@mail");
$mai->setTo("Κανένας", "panos");
$mai->setSubject("Μία δοκιμή", "UTF-8");
$mai->body = new Mailer_TextBody("Δοκιμή κειμένου");
break;
case 'alt':
$mai->setFrom("Πάνος", "my@mail");
$mai->setTo("Κανένας", "panos");
$mai->setSubject("Μία δοκιμή", "UTF-8");
$mai->body = new Mailer_MultipartAlt();
$mai->body->addPart(new Mailer_TextBody("Δοκιμή κειμένου"));
$mai->body->addPart(new Mailer_HtmlBody("<html><body>Δοκιμή <u>κειμένου</u></body></html>"));
break;
}
$mai->PrintMail();
示例8: Send_Mails
function Send_Mails($dbg = 1, $dry = false)
{
$dbhandle = A2Billing::DBHandle();
if ($dbg > 2) {
echo "Mailer: start\n";
}
$sqlTimeFmt = _("YYYY-MM-DD HH24:MI:SS TZ");
// TODO: not only select, but lock mails in 'sending' state.
$qry = "SELECT cc_mailings.id AS id, mtype, fromname, fromemail, subject, \n\t\tmessage, defargs, tomail, args, to_char(tstamp,'{$sqlTimeFmt}') AS mdate\n\t\tFROM cc_templatemail, cc_mailings\n\t\tWHERE cc_mailings.tmail_id = cc_templatemail.id\n\t\tAND (state = 1 OR state = 5);";
$res = $dbhandle->Execute($qry);
if (!$res) {
if ($dbg > 0) {
echo "Query Failed: " . $dbhandle->ErrorMsg() . "\n";
}
return false;
} elseif ($res->EOF) {
if ($dbg > 2) {
echo "No mails need to be sent.\n";
}
return true;
}
try {
while ($row = $res->fetchRow()) {
if ($dbg > 2) {
echo "Sending " . $row['mtype'] . " to " . $row['tomail'] . "\n";
}
if (empty($row['tomail'])) {
if ($dbg > 2) {
echo "No recepient specified!\n";
}
continue;
}
$mai = new Mailer();
$mai->setTo('', $row['tomail']);
$mai->setFrom($row['fromname'], $row['fromemail']);
// Format parameters
$defargs = array();
parse_str($row['defargs'], $defargs);
$defargs['mdate'] = $row['mdate'];
$toargs = array();
parse_str($row['args'], $toargs);
$args = array_merge($defargs, $toargs);
if ($dbg > 2) {
echo "Arguments:";
print_r($args);
echo "\n";
}
$mai->setSubject(str_alparams($row['subject'], $args), "UTF-8");
$mai->body = new Mailer_TextBody(str_alparams($row['message'], $args));
if ($dry) {
$mai->PrintMail();
continue;
}
try {
if ($dbg > 2) {
echo "Sending mail..";
}
$mai->SendMail();
if ($dbg > 2) {
echo " done.\n";
}
update_mailing($dbhandle, $row['id'], true, $dbg);
} catch (Exception $ex) {
if ($dbg > 2) {
echo " failed.\n";
}
update_mailing($dbhandle, $row['id'], false, $dbg);
throw $ex;
}
}
} catch (Exception $ex) {
if ($dbg > 1) {
echo "Exception: " . $ex->getMessage();
}
}
return true;
}