本文整理汇总了PHP中Mail::setFromMail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::setFromMail方法的具体用法?PHP Mail::setFromMail怎么用?PHP Mail::setFromMail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::setFromMail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actSave
function actSave()
{
global $ST, $post, $get;
$id = $post->getInt('id');
$field = array('time' => $post->get('time'), 'name' => $post->get('name'), 'mail' => $post->get('mail'), 'phone' => $post->get('phone'), 'theme' => $post->get('theme'), 'comment' => $post->get('comment'), 'answer' => $post->get('answer'), 'order_num' => $post->get('order_num'));
if ($id) {
$ST->update('sc_guestbook', $_POST, "id=" . $id);
} else {
$id = $ST->insert('sc_guestbook', $post->get());
}
if ($get->exists('type') == 'save_with_notice') {
$mail = new Mail();
$mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
$mail->setTemplate('letter_guestbook', array('FROM_SITE' => $this->cfg('SITE'), 'COMMENT' => $field['comment'], 'ANSWER' => $field['answer'], 'NAME' => $field['name']));
$mail->xsend($field['mail']);
}
echo printJSON(array('msg' => 'Сохранено', 'id' => $id));
exit;
}
示例2: actSave
function actSave()
{
global $ST, $get, $post;
$id = $post->getInt('id');
$data = array('content' => $post->get('content'), 'description' => $post->get('description'), 'title' => $post->get('title'), 'author' => $post->get('author'), 'date' => dte($post->get('date'), 'Y-m-d'), 'state' => $post->get('state'), 'category' => $post->getInt('category'), 'position' => $post->getInt('position'), 'gallery' => $post->getInt('gallery'), 'type' => $this->getType());
$img_out = "";
if (!empty($_FILES['upload']['name']) && isImg($_FILES['upload']['name'])) {
$img = $this->cfg('NEWS_IMAGE_PATH') . '/' . md5($_FILES['upload']['tmp_name']) . "." . file_ext($_FILES['upload']['name']);
move_uploaded_file($_FILES['upload']['tmp_name'], ROOT . $img);
$data['img'] = $img;
$img_out = scaleImg($img, 'w200');
}
if ($post->getInt('clear')) {
$data['img'] = '';
}
if ($id) {
$ST->update('sc_news', $data, "id=" . $id);
} else {
$id = $ST->insert('sc_news', $data);
}
$ST->delete('sc_relation', "parent={$id} AND type='public'");
foreach ($post->getArray('public_rel') as $v) {
$ST->insert('sc_relation', array('parent' => $id, 'type' => 'public', 'child' => $v));
}
$msg = "Сохранено";
if (true) {
$content = '';
$content .= '<small>' . date('d.m.Y') . '</small> ';
$content .= '<strong>' . $post->getHtml('title') . '</strong><br />';
$content .= '<span>' . $post->getHtml('description') . '</span><br />';
$content .= '<a href="http://' . $this->cfg('SITE') . '/' . $post->get('type') . '/' . $id . '/">подробнее...</a>';
if ($post->exists('save_and_send')) {
$mail = new Mail();
$mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
$key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($this->getUser('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $this->getUser('mail');
$key = '<a href="' . $key . '">' . $key . '</a>';
$mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
$mail->xsend($this->getUser('mail'), array('UNSUBSCRIBE' => $key));
} elseif ($post->exists('save_and_send_all')) {
$q = "SELECT distinct mail,id FROM sc_subscribe WHERE type LIKE '%" . $this->getType() . "%' \r\n\t\t\t\tAND NOT EXISTS(SELECT mailid FROM sc_news_sendlog WHERE id=mailid AND newsid={$id}){$this->getMailFilter()}";
if ($post->getInt('pack')) {
$q .= " LIMIT {$post->getInt('pack')}";
}
$rs = $ST->select($q);
$mail = new Mail();
// $mail->setFromMail($this->getConfig('mail'));
$mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
$mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
$n = 0;
while ($rs->next()) {
if (check_mail($m = trim($rs->get('mail')))) {
$key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $rs->get('mail');
$key = '<a href="' . $key . '">' . $key . '</a>';
$mail->xsend($m, array('UNSUBSCRIBE' => $key));
$ST->insert('sc_news_sendlog', array('mailid' => $rs->get('id'), 'newsid' => $id));
$n++;
} else {
$ST->delete('sc_subscribe', "mail='" . SQL::slashes($rs->get('mail')) . "'");
}
}
$msg .= " отправлено {$n}";
}
}
echo printJSONP(array('msg' => $msg, 'id' => $id, 'img' => $img_out));
exit;
}
示例3: sendTemplateMail
function sendTemplateMail($to, $templateName, $varList = null, $attachments = array())
{
$FROM_MAIL = FROM_MAIL;
$varList = array_merge($varList, array('FROM_SITE' => FROM_SITE));
if ($mail = $this->cfg("FROM_MAIL")) {
$FROM_MAIL = $mail;
}
if (isset($varList['from_mail'])) {
$FROM_MAIL = $varList['from_mail'];
}
$mail = new Mail();
$mail->setTemplate($templateName, $varList);
$mail->setFromMail($FROM_MAIL);
foreach ($attachments as $a) {
$mail->addAttachment($a);
}
$mail->xsend($to, $varList);
}
示例4: actSave
function actSave()
{
global $ST, $get, $post;
$id = $post->getInt('id');
$data = array('content' => $post->get('content'), 'description' => $post->get('description'), 'title' => $post->get('title'), 'author' => $post->get('author'), 'date' => dte($post->get('date'), 'Y-m-d'), 'date_to' => $post->get('date_to') ? dte($post->get('date_to'), 'Y-m-d') : null, 'state' => $post->get('state'), 'img' => $post->get('img'), 'gallery' => $post->getInt('gallery'), 'position' => $post->getInt('position'), 'type' => $this->getType());
if ($data['img'] && file_exists(ROOT . $data['img'])) {
$from = ROOT . $data['img'];
$name = md5_file(ROOT . $data['img']) . '.' . substr($data['img'], -3);
$path = $this->cfg('NEWS_IMAGE_PATH') . '/' . $name;
$data['img'] = $path;
if (!file_exists(ROOT . $data['img'])) {
rename($from, ROOT . $data['img']);
}
} elseif ($data['img'] == 'clear') {
$data['img'] = '';
}
if ($id) {
$ST->update('sc_news', $data, "id=" . $id);
} else {
$id = $ST->insert('sc_news', $data);
}
if (true) {
$content = '';
if ($post->get('type') == 'news') {
$content .= '<small>' . date('d.m.Y') . '</small> ';
}
$content .= '<strong>' . $post->getHtml('title') . '</strong><br />';
$content .= '<span>' . $post->getHtml('description') . '</span><br />';
$content .= '<a href="http://' . $this->cfg('SITE') . '/' . $post->get('type') . '/view/' . $id . '/">подробнее...</a>';
if ($get->exists('save_and_send')) {
$mail = new Mail();
$mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
$mail->setTemplate('letter_' . $post->get('type'), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content')));
$mail->xsend($this->getUser('mail'));
} elseif ($get->exists('save_and_send_all')) {
$rs = $ST->execute("SELECT distinct mail FROM sc_subscribe WHERE type LIKE '%" . $post->get('type') . "%'");
$mail = new Mail();
$mail->setFromMail($this->getConfig('mail'));
$mail->setFromMail(array($post->get('title'), $this->cfg('mail')));
$mail->setTemplate('letter_' . $post->get('type'), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content')));
while ($rs->next()) {
$key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $post->get('type') . 'unsubscribe') . '&type=' . $post->get('type') . '&mail=' . $rs->get('mail');
$key = '<a href="' . $key . '">' . $key . '</a>';
$mail->xsend($rs->get('mail'), array('UNSUBSCRIBE' => $key));
}
}
}
echo printJSON(array('msg' => 'Сохранено', 'nws_id' => $id));
exit;
}
示例5: dirname
$last_date = file_get_contents($last_time_fname);
}
$id = strtotime($last_date);
$q = "SELECT * FROM sc_shop_item i,sc_shop_proposal p,sc_users v WHERE p.itemid=i.id AND i.vendor=v.u_id AND p.create_time>'{$last_date}'";
$rs = DB::select($q)->toArray();
if (!$rs) {
exit;
}
ob_start();
include dirname(__FILE__) . "/catalog_subscribe.tpl.php";
$content = ob_get_contents();
ob_end_clean();
$type = 'catalog';
$mail = new Mail();
// $mail->setFromMail($this->getConfig('mail'));
$mail->setFromMail(array(Cfg::get('SITE'), Cfg::get('mail')));
$mail->setTemplate('letter_catalog', array('FROM_SITE' => Cfg::get('SITE'), 'CONTENT' => $content));
$q = "SELECT distinct mail,id FROM sc_subscribe WHERE type LIKE '%" . $type . "%' \n\t\t\t\tAND NOT EXISTS(SELECT mailid FROM sc_news_sendlog WHERE id=mailid AND newsid={$id})";
$rs = DB::select($q);
$n = 0;
while ($rs->next()) {
if (check_mail($m = trim($rs->get('mail')))) {
$key = 'http://' . Cfg::get('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $type . 'unsubscribe') . '&type=' . $type . '&mail=' . $rs->get('mail');
$key = '<a href="' . $key . '">' . $key . '</a>';
$mail->xsend($m, array('UNSUBSCRIBE' => $key));
DB::insert('sc_news_sendlog', array('mailid' => $rs->get('id'), 'newsid' => $id));
$n++;
} else {
DB::delete('sc_subscribe', "mail='" . SQL::slashes($rs->get('mail')) . "'");
}
}