本文整理汇总了PHP中SMTP::set_from方法的典型用法代码示例。如果您正苦于以下问题:PHP SMTP::set_from方法的具体用法?PHP SMTP::set_from怎么用?PHP SMTP::set_from使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMTP
的用法示例。
在下文中一共展示了SMTP::set_from方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
}
$count = array_merge($count_current, $count_before);
$smtp_server = APF::get_instance()->get_config('smtp_server');
$smtp_port = APF::get_instance()->get_config('smtp_port');
$smtp_user = APF::get_instance()->get_config('smtp_user');
$smtp_pass = APF::get_instance()->get_config('smtp_pass');
$smtp_usermail = APF::get_instance()->get_config('smtp_usermail');
$smtp_emailto = 'dl-tech-qa@anjuke.com';
$cc_to = 'dl-tech-haozu@anjuke.com,dl-tech-pd-aifang@anjuke.com,dl-tech-pdsec@anjuke.com,dl-tech-jpse@anjuke.com,ibug@anjuke.com';
$mail_subject = '[iBug]Daily Reporter' . ' - ' . $date;
$template = new Template();
$mail_body = $template->load_daily_reporter_html_template($count);
$mail_type = 'HTML';
$smtp = new SMTP($smtp_server, $smtp_port, true, $smtp_user, $smtp_pass);
$smtp->debug = true;
$smtp->set_from("IBug No-Reply", $smtp_usermail);
$flag = $smtp->sendmail($smtp_emailto, $smtp_usermail, $mail_subject, $mail_body, $mail_type, $cc_to);
echo date('c ') . "SMTP_SERVER: {$smtp_server} \n";
echo date('c ') . "SUBJECT: {$mail_subject} \n";
echo date('c ') . "FROM: {$smtp_usermail} \n";
echo date('c ') . "TO: {$smtp_emailto} \n";
echo date('c ') . "CC: {$cc_to} \n";
if ($flag) {
echo date('c ') . "Send Reporter Successfully!\n";
} else {
$filename = APF::get_instance()->get_config('mail_error_log');
$content = "Sent Daily Reporter - " . $date . " error\n";
if (is_writable($filename)) {
if (!($handle = fopen($filename, 'a'))) {
echo date('c ') . "Cannot open file " . $filename . "\n";
exit;
示例2: SMTP
}
// On défine where is the file
$file_up = $file_dir . $_FILES['file_up']['name'];
} else {
// We say that we have uploaded the file
$up = 1;
$file_up = 0;
}
// We check we have uploaded the file
if ($up && $no_empty_champs) {
// We include the SMTP class
include './Class.SMTP.php';
// We define the parametres of the SMTP connection
$smtp = new SMTP($smtp_serveur, $smtp_login, $smtp_passe, 25, $smtp_domain);
// We int the sender
$smtp->set_from($_POST['name'], $_POST['email']);
if ($file_up) {
// Attach file
$smtp->add_file($file_up);
}
// We define the Content type ( Value can be: html (for html), txt (for text), txt/html (for text and html) )
$smtp->ContentType = 'txt';
// We send the mail
$smtp->smtp_mail($mail_to, $_POST['sujet'], $_POST['msg']);
// We check that the mail as been send
if (!$smtp->erreur) {
echo '<div style="text-align:center; color:#008000;">Your mail as been send.</div>', "\r\n";
if ($file_up) {
// Delete tempory file
unlink($file_up);
}
示例3: SMTP
*
* Nom de la source :
* Class SMTP
* Nom du fichier par défaut :
* Version envoie simple avec une pièce jointe.php
* Auteur :
* Nuel Guillaume alias Immortal-PC
* Site Web :
* http://immortal-pc.info/
*
*******************************************************************************/
include './Class.SMTP.php';
$smtp = new SMTP('smtp.serveur.fr', 'login', 'pass', 25, 'immortal-pc.info');
$smtp2 = new SMTP('smtp.serveur_2.fr', 'login', 'pass', 25, 'immortal-pc.info');
$smtp->set_from('Immortal-PC', 'me@serveur.com', 'Site web Immortal-PC');
$smtp2->set_from('Immortal-PC', 'me@serveur.com', 'Site web Immortal-PC');
// Ajout des fichiers
$smtp->add_file('./Fichier_test.gif');
$smtp->add_file('./Fichier_test.txt');
$smtp2->add_file('./Fichier_test.gif');
$smtp2->add_file('./Fichier_test.txt');
$To = 'toyou@serveur.com';
// A QUI
$Sujet = 'Sujet';
// Sujet
$msg = 'Votre message ici' . "\r\n" . 'ça marche !!';
$smtp->smtp_mail($To, $Sujet, $msg);
// Envoie du mail ( Serveur 1 )
$smtp2->smtp_mail($To, $Sujet, $msg);
// Envoie du mail ( Serveur 2 )
if (!$smtp->erreur) {
示例4: SMTP
* http://immortal-pc.info/
*
* Translate by :
* Pierre CORBEL
* Web site :
* http://www.some-ideas.net/
*
*******************************************************************************/
include './Class.SMTP.php';
// If the SMTP server requiere authentification
// $smtp = new SMTP('smtp.server.com', 'login', 'pass', 'port', 'domain name', 'Debug; 0 desactivate');
// SMTP without authentification
// $smtp = new SMTP('smtp.server.com', '', '', 25, 'domain name', 'Debug; 0 desactivate');
$smtp = new SMTP('smtp.server.com', 'login', 'pass', 25, 'immortalpc.info', 0);
// From
$smtp->set_from('Immortal-PC', 'me@serveur.com');
// To
// Use coma to separate e-mail -> toto@email.com,titi@email.com
//$smtp->Bcc = 'toyou@serveur.com';// For hidden copy
//$smtp->Cc = 'toyou@serveur.com';// For normal copy
// Priority : 1 Urgent, 3 Normal, 6 Slow
$smtp->Priority = 3;
// Content type
$smtp->ContentType = 'text/txt';
// Content type (plain text, html...)
// Reception confirmation
$smtp->Confimation_reception = '';
// Email where wil be send the confirmation
//smtp_mail('toyou@server.com', 'subject', 'message', 'header')
if ($smtp->smtp_mail('toyou@server.com', 'subject', 'message')) {
echo '<div style="text-align:center; color:#008000;">The email is sended</div>', "\r\n";
示例5: notify
private function notify()
{
$smtpserver = $this->smtp['smtpserver'];
$smtpserverport = $this->smtp['smtpserverport'];
$smtpuser = $this->smtp['smtpuser'];
$smtppass = $this->smtp['smtppass'];
$smtp_usermail = $this->smtp['smtp_usermail'];
$smtp = new SMTP($smtpserver, $smtpserverport, false, $smtpuser, $smtppass);
$smtp->set_from("SearchCloud", "solr@sc10-001.a.ajkdns.com");
$smtp->debug = false;
$cc = '';
$bcc = '';
foreach ($this->alert as $name => $msg) {
if (empty($msg)) {
continue;
}
$userinfo = $this->get_user_info($name);
print_r($userinfo);
if (!empty($userinfo['email'])) {
/*发Email*/
$sent = $smtp->sendmail($userinfo['email'], $smtp_usermail, 'SearchCloud报警邮件', $msg, 'HTML', $cc, $bcc);
print_r($sent);
}
if (!empty($userinfo['mobile'])) {
/*发SMS*/
$sent = $smtp->sendmail($userinfo['mobile'] . '@139.com', $smtp_usermail, 'SearchCloud报警邮件', $msg, 'HTML', $cc, $bcc);
print_r($sent);
}
}
}