当前位置: 首页>>代码示例>>PHP>>正文


PHP mail::factory方法代码示例

本文整理汇总了PHP中mail::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP mail::factory方法的具体用法?PHP mail::factory怎么用?PHP mail::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mail的用法示例。


在下文中一共展示了mail::factory方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save


//.........这里部分代码省略.........
         }
         if (!$vars['priority_id']) {
             $errors['priority_id'] = 'You must select a priority';
         }
         if (!isset($vars['postfetch'])) {
             $errors['postfetch'] = 'Indicate what to do with fetched emails';
         } elseif (!strcasecmp($vars['postfetch'], 'archive')) {
             if (!$vars['mail_archivefolder']) {
                 $errors['postfetch'] = 'Valid folder required';
             }
         }
     }
     if ($vars['smtp_active']) {
         if (!$vars['smtp_host']) {
             $errors['smtp_host'] = 'Host name required';
         }
         if (!$vars['smtp_port']) {
             $errors['smtp_port'] = 'Port required';
         }
     }
     //abort on errors
     if ($errors) {
         return false;
     }
     if (!$errors && ($vars['mail_host'] && $vars['userid'])) {
         $sql = 'SELECT email_id FROM ' . EMAIL_TABLE . ' WHERE mail_host=' . db_input($vars['mail_host']) . ' AND userid=' . db_input($vars['userid']);
         if ($id) {
             $sql .= ' AND email_id!=' . db_input($id);
         }
         if (db_num_rows(db_query($sql))) {
             $errors['userid'] = $errors['host'] = 'Host/userid combination already in-use.';
         }
     }
     $passwd = $vars['passwd'] ? $vars['passwd'] : $vars['cpasswd'];
     if (!$errors && $vars['mail_active']) {
         //note: password is unencrypted at this point...MailFetcher expect plain text.
         $fetcher = new MailFetcher($vars['userid'], $passwd, $vars['mail_host'], $vars['mail_port'], $vars['mail_protocol'], $vars['mail_encryption']);
         if (!$fetcher->connect()) {
             $errors['err'] = 'Invalid login. Check ' . Format::htmlchars($vars['mail_protocol']) . ' settings';
             $errors['mail'] = '<br>' . $fetcher->getLastError();
         } elseif ($vars['mail_archivefolder'] && !$fetcher->checkMailbox($vars['mail_archivefolder'], true)) {
             $errors['postfetch'] = 'Invalid or unknown mail folder! >> ' . $fetcher->getLastError() . '';
             if (!$errors['mail']) {
                 $errors['mail'] = 'Invalid or unknown archive folder!';
             }
         }
     }
     if (!$errors && $vars['smtp_active']) {
         //Check SMTP login only.
         require_once 'Mail.php';
         // PEAR Mail package
         $smtp = mail::factory('smtp', array('host' => $vars['smtp_host'], 'port' => $vars['smtp_port'], 'auth' => $vars['smtp_auth'] ? true : false, 'username' => $vars['userid'], 'password' => $passwd, 'timeout' => 20, 'debug' => false));
         $mail = $smtp->connect();
         if (PEAR::isError($mail)) {
             $errors['err'] = 'Unable to login. Check SMTP settings.';
             $errors['smtp'] = '<br>' . $mail->getMessage();
         } else {
             $smtp->disconnect();
             //Thank you, sir!
         }
     }
     if ($errors) {
         return false;
     }
     //Default to default priority and dept..
     if (!$vars['priority_id'] && $cfg) {
         $vars['priority_id'] = $cfg->getDefaultPriorityId();
     }
     if (!$vars['dept_id'] && $cfg) {
         $vars['dept_id'] = $cfg->getDefaultDeptId();
     }
     $sql = 'updated=NOW(),mail_errors=0, mail_lastfetch=NULL' . ',email=' . db_input($vars['email']) . ',name=' . db_input(Format::striptags($vars['name'])) . ',dept_id=' . db_input($vars['dept_id']) . ',priority_id=' . db_input($vars['priority_id']) . ',noautoresp=' . db_input(isset($vars['noautoresp']) ? 1 : 0) . ',userid=' . db_input($vars['userid']) . ',mail_active=' . db_input($vars['mail_active']) . ',mail_host=' . db_input($vars['mail_host']) . ',mail_protocol=' . db_input($vars['mail_protocol'] ? $vars['mail_protocol'] : 'POP') . ',mail_encryption=' . db_input($vars['mail_encryption']) . ',mail_port=' . db_input($vars['mail_port'] ? $vars['mail_port'] : 0) . ',mail_fetchfreq=' . db_input($vars['mail_fetchfreq'] ? $vars['mail_fetchfreq'] : 0) . ',mail_fetchmax=' . db_input($vars['mail_fetchmax'] ? $vars['mail_fetchmax'] : 0) . ',smtp_active=' . db_input($vars['smtp_active']) . ',smtp_host=' . db_input($vars['smtp_host']) . ',smtp_port=' . db_input($vars['smtp_port'] ? $vars['smtp_port'] : 0) . ',smtp_auth=' . db_input($vars['smtp_auth']) . ',smtp_spoofing=' . db_input(isset($vars['smtp_spoofing']) ? 1 : 0) . ',notes=' . db_input($vars['notes']);
     //Post fetch email handling...
     if ($vars['postfetch'] && !strcasecmp($vars['postfetch'], 'delete')) {
         $sql .= ',mail_delete=1,mail_archivefolder=NULL';
     } elseif ($vars['postfetch'] && !strcasecmp($vars['postfetch'], 'archive') && $vars['mail_archivefolder']) {
         $sql .= ',mail_delete=0,mail_archivefolder=' . db_input($vars['mail_archivefolder']);
     } else {
         $sql .= ',mail_delete=0,mail_archivefolder=NULL';
     }
     if ($vars['passwd']) {
         //New password - encrypt.
         $sql .= ',userpass=' . db_input(Mcrypt::encrypt($vars['passwd'], SECRET_SALT));
     }
     if ($id) {
         //update
         $sql = 'UPDATE ' . EMAIL_TABLE . ' SET ' . $sql . ' WHERE email_id=' . db_input($id);
         if (db_query($sql) && db_affected_rows()) {
             return true;
         }
         $errors['err'] = 'Unable to update email. Internal error occurred';
     } else {
         $sql = 'INSERT INTO ' . EMAIL_TABLE . ' SET ' . $sql . ',created=NOW()';
         if (db_query($sql) && ($id = db_insert_id())) {
             return $id;
         }
         $errors['err'] = 'Unable to add email. Internal error';
     }
     return false;
 }
开发者ID:nicolap,项目名称:osTicket-1.7,代码行数:101,代码来源:class.email.php

示例2: send

 function send($to, $subject, $message, $options = null)
 {
     global $ost;
     //Get the goodies
     require_once PEAR_DIR . 'Mail.php';
     // PEAR Mail package
     require_once PEAR_DIR . 'Mail/mime.php';
     // PEAR Mail_Mime packge
     //do some cleanup
     $to = preg_replace("/(\r\n|\r|\n)/s", '', trim($to));
     $subject = preg_replace("/(\r\n|\r|\n)/s", '', trim($subject));
     //We're decoding html entities here becasuse we only support plain text for now - html support comming.
     $body = Format::htmldecode(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));
     /* Message ID - generated for each outgoing email */
     $messageId = sprintf('<%s%d-%s>', Misc::randCode(6), time(), $this->getEmail() ? $this->getEmail()->getEmail() : '@osTicketMailer');
     $headers = array('From' => $this->getFromAddress(), 'To' => $to, 'Subject' => $subject, 'Date' => date('D, d M Y H:i:s O'), 'Message-ID' => $messageId, 'X-Mailer' => 'osTicket Mailer');
     //Set bulk/auto-response headers.
     if ($options && ($options['autoreply'] or $options['bulk'])) {
         $headers += array('X-Autoreply' => 'yes', 'X-Auto-Response-Suppress' => 'ALL, AutoReply', 'Auto-Submitted' => 'auto-replied');
         if ($options['bulk']) {
             $headers += array('Precedence' => 'bulk');
         } else {
             $headers += array('Precedence' => 'auto_reply');
         }
     }
     if ($options) {
         if (isset($options['inreplyto']) && $options['inreplyto']) {
             $headers += array('In-Reply-To' => $options['inreplyto']);
         }
         if (isset($options['references']) && $options['references']) {
             if (is_array($options['references'])) {
                 $headers += array('References' => implode(' ', $options['references']));
             } else {
                 $headers += array('References' => $options['references']);
             }
         }
     }
     $mime = new Mail_mime();
     $mime->setTXTBody($body);
     //XXX: Attachments
     if ($attachments = $this->getAttachments()) {
         foreach ($attachments as $attachment) {
             if ($attachment['file_id'] && ($file = AttachmentFile::lookup($attachment['file_id']))) {
                 $mime->addAttachment($file->getData(), $file->getType(), $file->getName(), false);
             } elseif ($attachment['file'] && file_exists($attachment['file']) && is_readable($attachment['file'])) {
                 $mime->addAttachment($attachment['file'], $attachment['type'], $attachment['name']);
             }
         }
     }
     //Desired encodings...
     $encodings = array('head_encoding' => 'quoted-printable', 'text_encoding' => 'base64', 'html_encoding' => 'base64', 'html_charset' => 'utf-8', 'text_charset' => 'utf-8', 'head_charset' => 'utf-8');
     //encode the body
     $body = $mime->get($encodings);
     //encode the headers.
     $headers = $mime->headers($headers, true);
     if ($smtp = $this->getSMTPInfo()) {
         //Send via SMTP
         $mail = mail::factory('smtp', array('host' => $smtp['host'], 'port' => $smtp['port'], 'auth' => $smtp['auth'], 'username' => $smtp['username'], 'password' => $smtp['password'], 'timeout' => 20, 'debug' => false));
         $result = $mail->send($to, $headers, $body);
         if (!PEAR::isError($result)) {
             return $messageId;
         }
         $alert = sprintf("Unable to email via SMTP:%s:%d [%s]\n\n%s\n", $smtp['host'], $smtp['port'], $smtp['username'], $result->getMessage());
         $this->logError($alert);
     }
     //No SMTP or it failed....use php's native mail function.
     $mail = mail::factory('mail');
     return PEAR::isError($mail->send($to, $headers, $body)) ? false : $messageId;
 }
开发者ID:pkdevboxy,项目名称:osTicket-1.7,代码行数:69,代码来源:class.mailer.php

示例3: save

 function save($id, $vars, &$errors)
 {
     global $cfg;
     //very basic checks
     if ($id && $id != $vars['email_id']) {
         $errors['err'] = 'Internal error.';
     }
     if (!$vars['email'] || !Validator::is_email($vars['email'])) {
         $errors['email'] = 'Valid email required';
     } elseif (($eid = Email::getIdByEmail($vars['email'])) && $eid != $id) {
         $errors['email'] = 'Email already exits';
     } elseif (!strcasecmp($cfg->getAdminEmail(), $vars['email'])) {
         $errors['email'] = 'Email already used as admin email!';
     } else {
         //make sure the email doesn't belong to any of the staff
         $sql = 'SELECT staff_id FROM ' . STAFF_TABLE . ' WHERE email=' . db_input($vars['email']);
         if (($res = db_query($sql)) && db_num_rows($res)) {
             $errors['email'] = 'Email in-use by a staff member';
         }
     }
     if (!$vars['dept_id'] || !is_numeric($vars['dept_id'])) {
         $errors['dept_id'] = 'You must select a Dept.';
     }
     if (!$vars['priority_id']) {
         $errors['priority_id'] = 'You must select a priority';
     }
     if ($vars['mail_active'] || $vars['smtp_active'] && $vars['smtp_auth']) {
         if (!$vars['userid']) {
             $errors['userid'] = 'Username missing';
         }
         if (!$vars['userpass']) {
             $errors['userpass'] = 'Password required';
         }
     }
     if ($vars['mail_active']) {
         //Check pop/imapinfo only when enabled.
         if (!function_exists('imap_open')) {
             $errors['mail_active'] = 'IMAP doesn\'t exist. PHP must be compiled with IMAP enabled.';
         }
         if (!$vars['mail_host']) {
             $errors['mail_host'] = 'Host name required';
         }
         if (!$vars['mail_port']) {
             $errors['mail_port'] = 'Port required';
         }
         if (!$vars['mail_protocol']) {
             $errors['mail_protocol'] = 'Select protocol';
         }
         if (!$vars['mail_fetchfreq'] || !is_numeric($vars['mail_fetchfreq'])) {
             $errors['mail_fetchfreq'] = 'Fetch interval required';
         }
         if (!$vars['mail_fetchmax'] || !is_numeric($vars['mail_fetchmax'])) {
             $errors['mail_fetchmax'] = 'Maximum emails required';
         }
     }
     if ($vars['smtp_active']) {
         if (!$vars['smtp_host']) {
             $errors['smtp_host'] = 'Host name required';
         }
         if (!$vars['smtp_port']) {
             $errors['smtp_port'] = 'Port required';
         }
     }
     if (!$errors && ($vars['mail_host'] && $vars['userid'])) {
         $sql = 'SELECT email_id FROM ' . EMAIL_TABLE . ' WHERE mail_host=' . db_input($vars['mail_host']) . ' AND userid=' . db_input($vars['userid']);
         if ($id) {
             $sql .= ' AND email_id!=' . db_input($id);
         }
         if (db_num_rows(db_query($sql))) {
             $errors['userid'] = $errors['host'] = 'Another department using host/username combination.';
         }
     }
     if (!$errors && $vars['mail_active']) {
         //note: password is unencrypted at this point...MailFetcher expect plain text.
         $fetcher = new MailFetcher($vars['userid'], $vars['userpass'], $vars['mail_host'], $vars['mail_port'], $vars['mail_protocol'], $vars['mail_encryption']);
         if (!$fetcher->connect()) {
             $errors['userpass'] = '<br>Invalid login. Check ' . $vars['mail_protocol'] . ' settings';
             $errors['mail'] = '<br>' . $fetcher->getLastError();
         }
     }
     if (!$errors && $vars['smtp_active']) {
         //Check SMTP login only.
         require_once 'Mail.php';
         // PEAR Mail package
         $smtp = mail::factory('smtp', array('host' => $vars['smtp_host'], 'port' => $vars['smtp_port'], 'auth' => $vars['smtp_auth'] ? true : false, 'username' => $vars['userid'], 'password' => $vars['userpass'], 'timeout' => 20, 'debug' => false));
         $mail = $smtp->connect();
         if (PEAR::isError($mail)) {
             $errors['userpass'] = '<br>Unable to login. Check SMTP settings.';
             $errors['smtp'] = '<br>' . $mail->getMessage();
         } else {
             $smtp->disconnect();
             //Thank you, sir!
         }
     }
     if (!$errors) {
         $sql = 'updated=NOW(),mail_errors=0, mail_lastfetch=NULL' . ',email=' . db_input($vars['email']) . ',name=' . db_input(Format::striptags($vars['name'])) . ',dept_id=' . db_input($vars['dept_id']) . ',priority_id=' . db_input($vars['priority_id']) . ',noautoresp=' . db_input(isset($vars['noautoresp']) ? 1 : 0) . ',userid=' . db_input($vars['userid']) . ',userpass=' . db_input(Misc::encrypt($vars['userpass'], SECRET_SALT)) . ',mail_active=' . db_input($vars['mail_active']) . ',mail_host=' . db_input($vars['mail_host']) . ',mail_protocol=' . db_input($vars['mail_protocol'] ? $vars['mail_protocol'] : 'POP') . ',mail_encryption=' . db_input($vars['mail_encryption']) . ',mail_port=' . db_input($vars['mail_port'] ? $vars['mail_port'] : 0) . ',mail_fetchfreq=' . db_input($vars['mail_fetchfreq'] ? $vars['mail_fetchfreq'] : 0) . ',mail_fetchmax=' . db_input($vars['mail_fetchmax'] ? $vars['mail_fetchmax'] : 0) . ',mail_delete=' . db_input(isset($vars['mail_delete']) ? $vars['mail_delete'] : 0) . ',smtp_active=' . db_input($vars['smtp_active']) . ',smtp_host=' . db_input($vars['smtp_host']) . ',smtp_port=' . db_input($vars['smtp_port'] ? $vars['smtp_port'] : 0) . ',smtp_auth=' . db_input($vars['smtp_auth']);
         if ($id) {
             //update
             $sql = 'UPDATE ' . EMAIL_TABLE . ' SET ' . $sql . ' WHERE email_id=' . db_input($id);
             if (!db_query($sql) || !db_affected_rows()) {
//.........这里部分代码省略.........
开发者ID:KingsleyGU,项目名称:OSTicket-Reloaded,代码行数:101,代码来源:class.email.php

示例4: save

 function save($id, $vars, &$errors)
 {
     global $cfg;
     //very basic checks
     if ($id && $id != $vars['email_id']) {
         $errors['err'] = 'Erro interno.';
     }
     if (!$vars['email'] || !Validator::is_email($vars['email'])) {
         $errors['email'] = 'Email válido obrigatório';
     } elseif (($eid = Email::getIdByEmail($vars['email'])) && $eid != $id) {
         $errors['email'] = 'Email já existe.';
     } elseif (!strcasecmp($cfg->getAdminEmail(), $vars['email'])) {
         $errors['email'] = 'Email já usado como email do administrador!';
     } else {
         //make sure the email doesn't belong to any of the staff
         $sql = 'SELECT staff_id FROM ' . STAFF_TABLE . ' WHERE email=' . db_input($vars['email']);
         if (($res = db_query($sql)) && db_num_rows($res)) {
             $errors['email'] = 'Email em uso por um membro do suporte.';
         }
     }
     if (!$vars['dept_id'] || !is_numeric($vars['dept_id'])) {
         $errors['dept_id'] = 'Você deve selecionar um departamento.';
     }
     if (!$vars['priority_id']) {
         $errors['priority_id'] = 'Você deve selecionar uma prioridade';
     }
     if ($vars['mail_active'] || $vars['smtp_active'] && $vars['smtp_auth']) {
         if (!$vars['userid']) {
             $errors['userid'] = 'Nome de usuário ausente';
         }
         if (!$vars['userpass']) {
             $errors['userpass'] = 'Senha obrigatória';
         }
     }
     if ($vars['mail_active']) {
         //Check pop/imapinfo only when enabled.
         if (!function_exists('imap_open')) {
             $errors['mail_active'] = 'IMAP não existe. PHP deve ser compilado com IMAP habilitado.';
         }
         if (!$vars['mail_host']) {
             $errors['mail_host'] = 'Nome do host obrigatório';
         }
         if (!$vars['mail_port']) {
             $errors['mail_port'] = 'Porta obrigatória';
         }
         if (!$vars['mail_protocol']) {
             $errors['mail_protocol'] = 'Selecione protocolo';
         }
         if (!$vars['mail_fetchfreq'] || !is_numeric($vars['mail_fetchfreq'])) {
             $errors['mail_fetchfreq'] = 'Buscar intervalo obrigatório';
         }
         if (!$vars['mail_fetchmax'] || !is_numeric($vars['mail_fetchmax'])) {
             $errors['mail_fetchmax'] = 'Máximo de emails exigidos';
         }
     }
     if ($vars['smtp_active']) {
         if (!$vars['smtp_host']) {
             $errors['smtp_host'] = 'Nome do host obrigatório';
         }
         if (!$vars['smtp_port']) {
             $errors['smtp_port'] = 'Porta obrigatória';
         }
     }
     if (!$errors && ($vars['mail_host'] && $vars['userid'])) {
         $sql = 'SELECT email_id FROM ' . EMAIL_TABLE . ' WHERE mail_host=' . db_input($vars['mail_host']) . ' AND userid=' . db_input($vars['userid']);
         if ($id) {
             $sql .= ' AND email_id!=' . db_input($id);
         }
         if (db_num_rows(db_query($sql))) {
             $errors['userid'] = $errors['host'] = 'Outro departamento está usando combinação de nome/host.';
         }
     }
     if (!$errors && $vars['mail_active']) {
         //note: password is unencrypted at this point...MailFetcher expect plain text.
         $fetcher = new MailFetcher($vars['userid'], $vars['userpass'], $vars['mail_host'], $vars['mail_port'], $vars['mail_protocol'], $vars['mail_encryption']);
         if (!$fetcher->connect()) {
             $errors['userpass'] = '<br>Login Inválido. Verifique as ' . $vars['mail_protocol'] . ' configurações';
             $errors['mail'] = '<br>' . $fetcher->getLastError();
         }
     }
     if (!$errors && $vars['smtp_active']) {
         //Check SMTP login only.
         require_once 'Mail.php';
         // PEAR Mail package
         $smtp = mail::factory('smtp', array('host' => $vars['smtp_host'], 'port' => $vars['smtp_port'], 'auth' => $vars['smtp_auth'] ? true : false, 'username' => $vars['userid'], 'password' => $vars['userpass'], 'timeout' => 20, 'debug' => false));
         $mail = $smtp->connect();
         if (PEAR::isError($mail)) {
             $errors['userpass'] = '<br>Incapaz de fazer o login. Verifique as configurações SMTP.';
             $errors['smtp'] = '<br>' . $mail->getMessage();
         } else {
             $smtp->disconnect();
             //Thank you, sir!
         }
     }
     if (!$errors) {
         $sql = 'updated=NOW(),mail_errors=0, mail_lastfetch=NULL' . ',email=' . db_input($vars['email']) . ',name=' . db_input(Format::striptags($vars['name'])) . ',dept_id=' . db_input($vars['dept_id']) . ',priority_id=' . db_input($vars['priority_id']) . ',noautoresp=' . db_input(isset($vars['noautoresp']) ? 1 : 0) . ',userid=' . db_input($vars['userid']) . ',userpass=' . db_input(Misc::encrypt($vars['userpass'], SECRET_SALT)) . ',mail_active=' . db_input($vars['mail_active']) . ',mail_host=' . db_input($vars['mail_host']) . ',mail_protocol=' . db_input($vars['mail_protocol'] ? $vars['mail_protocol'] : 'POP') . ',mail_encryption=' . db_input($vars['mail_encryption']) . ',mail_port=' . db_input($vars['mail_port'] ? $vars['mail_port'] : 0) . ',mail_fetchfreq=' . db_input($vars['mail_fetchfreq'] ? $vars['mail_fetchfreq'] : 0) . ',mail_fetchmax=' . db_input($vars['mail_fetchmax'] ? $vars['mail_fetchmax'] : 0) . ',mail_delete=' . db_input(isset($vars['mail_delete']) ? $vars['mail_delete'] : 0) . ',smtp_active=' . db_input($vars['smtp_active']) . ',smtp_host=' . db_input($vars['smtp_host']) . ',smtp_port=' . db_input($vars['smtp_port'] ? $vars['smtp_port'] : 0) . ',smtp_auth=' . db_input($vars['smtp_auth']);
         if ($id) {
             //update
             $sql = 'UPDATE ' . EMAIL_TABLE . ' SET ' . $sql . ' WHERE email_id=' . db_input($id);
             if (!db_query($sql) || !db_affected_rows()) {
//.........这里部分代码省略.........
开发者ID:ricardowarhead,项目名称:osticket_pt_BR,代码行数:101,代码来源:class.email.php

示例5: send

 function send($to, $subject, $message, $options = null)
 {
     global $ost;
     //Get the goodies
     require_once PEAR_DIR . 'Mail.php';
     // PEAR Mail package
     require_once PEAR_DIR . 'Mail/mime.php';
     // PEAR Mail_Mime packge
     //do some cleanup
     $to = preg_replace("/(\r\n|\r|\n)/s", '', trim($to));
     $subject = stripslashes(preg_replace("/(\r\n|\r|\n)/s", '', trim($subject)));
     $body = stripslashes(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));
     /* Message ID - generated for each outgoing email */
     $messageId = sprintf('<%s%d-%s>', Misc::randCode(6), time(), $this->getEmail() ? $this->getEmail()->getEmail() : '@osTicketMailer');
     $headers = array('From' => $this->getFromAddress(), 'To' => $to, 'Subject' => $subject, 'Date' => date('D, d M Y H:i:s O'), 'Message-ID' => $messageId, 'X-Mailer' => 'osTicket Mailer', 'Content-Type' => 'text/html; charset="UTF-8"');
     $mime = new Mail_mime();
     $mime->setTXTBody($body);
     //XXX: Attachments
     if ($attachments = $this->getAttachments()) {
         foreach ($attachments as $attachment) {
             if ($attachment['file_id'] && ($file = AttachmentFile::lookup($attachment['file_id']))) {
                 $mime->addAttachment($file->getData(), $file->getType(), $file->getName(), false);
             } elseif ($attachment['file'] && file_exists($attachment['file']) && is_readable($attachment['file'])) {
                 $mime->addAttachment($attachment['file'], $attachment['type'], $attachment['name']);
             }
         }
     }
     //Desired encodings...
     $encodings = array('head_encoding' => 'quoted-printable', 'text_encoding' => 'quoted-printable', 'html_encoding' => 'base64', 'html_charset' => 'utf-8', 'text_charset' => 'utf-8', 'head_charset' => 'utf-8');
     //encode the body
     $body = $mime->get($encodings);
     //encode the headers.
     $headers = $mime->headers($headers);
     if ($smtp = $this->getSMTPInfo()) {
         //Send via SMTP
         $mail = mail::factory('smtp', array('host' => $smtp['host'], 'port' => $smtp['port'], 'auth' => $smtp['auth'], 'username' => $smtp['username'], 'password' => $smtp['password'], 'timeout' => 20, 'debug' => false));
         $result = $mail->send($to, $headers, $body);
         if (!PEAR::isError($result)) {
             return $messageId;
         }
         $alert = sprintf("Unable to email via SMTP:%s:%d [%s]\n\n%s\n", $smtp['host'], $smtp['port'], $smtp['username'], $result->getMessage());
         $this->logError($alert);
     }
     //No SMTP or it failed....use php's native mail function.
     $mail = mail::factory('mail');
     return PEAR::isError($mail->send($to, $headers, $body)) ? false : $messageId;
 }
开发者ID:nunomartins,项目名称:osTicket-1.7,代码行数:47,代码来源:class.mailer.php

示例6: send


//.........这里部分代码省略.........
         if (isset($options['references']) && $options['references']) {
             if (is_array($options['references'])) {
                 $headers += array('References' => implode(' ', $options['references']));
             } else {
                 $headers += array('References' => $options['references']);
             }
         }
     }
     // The Suhosin patch will muck up the line endings in some
     // cases
     //
     // References:
     // https://github.com/osTicket/osTicket-1.8/issues/202
     // http://pear.php.net/bugs/bug.php?id=12032
     // http://us2.php.net/manual/en/function.mail.php#97680
     if ((extension_loaded('suhosin') || defined("SUHOSIN_PATCH")) && !$this->getSMTPInfo()) {
         $mime = new Mail_mime("\n");
     } else {
         // Use defaults
         $mime = new Mail_mime();
     }
     // If the message is not explicitly declared to be a text message,
     // then assume that it needs html processing to create a valid text
     // body
     $isHtml = true;
     $mid_token = isset($options['thread']) ? $options['thread']->asMessageId($to) : '';
     if (!(isset($options['text']) && $options['text'])) {
         if ($cfg && $cfg->stripQuotedReply() && ($tag = $cfg->getReplySeparator()) && (!isset($options['reply-tag']) || $options['reply-tag'])) {
             $message = "<div style=\"display:none\"\n                    data-mid=\"{$mid_token}\">{$tag}<br/><br/></div>{$message}";
         }
         $txtbody = rtrim(Format::html2text($message, 90, false)) . ($mid_token ? "\nRef-Mid: {$mid_token}\n" : '');
         $mime->setTXTBody($txtbody);
     } else {
         $mime->setTXTBody($message);
         $isHtml = false;
     }
     if ($isHtml && $cfg && $cfg->isHtmlThreadEnabled()) {
         // Pick a domain compatible with pear Mail_Mime
         $matches = array();
         if (preg_match('#(@[0-9a-zA-Z\\-\\.]+)#', $this->getFromAddress(), $matches)) {
             $domain = $matches[1];
         } else {
             $domain = '@localhost';
         }
         // Format content-ids with the domain, and add the inline images
         // to the email attachment list
         $self = $this;
         $message = preg_replace_callback('/cid:([\\w.-]{32})/', function ($match) use($domain, $mime, $self) {
             if (!($file = AttachmentFile::lookup($match[1]))) {
                 return $match[0];
             }
             $mime->addHTMLImage($file->getData(), $file->getType(), $file->getName(), false, $match[1] . $domain);
             // Don't re-attach the image below
             unset($self->attachments[$file->getId()]);
             return $match[0] . $domain;
         }, $message);
         // Add an HTML body
         $mime->setHTMLBody($message);
     }
     //XXX: Attachments
     if ($attachments = $this->getAttachments()) {
         foreach ($attachments as $attachment) {
             if ($attachment['file_id'] && ($file = AttachmentFile::lookup($attachment['file_id']))) {
                 $mime->addAttachment($file->getData(), $file->getType(), $file->getName(), false);
             }
         }
     }
     //Desired encodings...
     $encodings = array('head_encoding' => 'quoted-printable', 'text_encoding' => 'base64', 'html_encoding' => 'base64', 'html_charset' => 'utf-8', 'text_charset' => 'utf-8', 'head_charset' => 'utf-8');
     //encode the body
     $body = $mime->get($encodings);
     //encode the headers.
     $headers = $mime->headers($headers, true);
     // Cache smtp connections made during this request
     static $smtp_connections = array();
     if ($smtp = $this->getSMTPInfo()) {
         //Send via SMTP
         $key = sprintf("%s:%s:%s", $smtp['host'], $smtp['port'], $smtp['username']);
         if (!isset($smtp_connections[$key])) {
             $mail = mail::factory('smtp', array('host' => $smtp['host'], 'port' => $smtp['port'], 'auth' => $smtp['auth'], 'username' => $smtp['username'], 'password' => $smtp['password'], 'timeout' => 20, 'debug' => false, 'persist' => true));
             if ($mail->connect()) {
                 $smtp_connections[$key] = $mail;
             }
         } else {
             // Use persistent connection
             $mail = $smtp_connections[$key];
         }
         $result = $mail->send($to, $headers, $body);
         if (!PEAR::isError($result)) {
             return $messageId;
         }
         // Force reconnect on next ->send()
         unset($smtp_connections[$key]);
         $alert = sprintf("Unable to email via SMTP:%s:%d [%s]\n\n%s\n", $smtp['host'], $smtp['port'], $smtp['username'], $result->getMessage());
         $this->logError($alert);
     }
     //No SMTP or it failed....use php's native mail function.
     $mail = mail::factory('mail');
     return PEAR::isError($mail->send($to, $headers, $body)) ? false : $messageId;
 }
开发者ID:Jride,项目名称:OSTicket-Thaiconnections,代码行数:101,代码来源:class.mailer.php

示例7: send


//.........这里部分代码省略.........
         if ($irt = $options['thread']->getEmailMessageId()) {
             // This is an response from an email, like and autoresponse.
             // Web posts will not have a email message-id
             $headers += array('In-Reply-To' => $irt, 'References' => $options['thread']->getEmailReferences());
         } elseif ($parent = $options['thread']->getParent()) {
             // Use the parent item as the email information source. This
             // will apply for staff replies
             $headers += array('In-Reply-To' => $parent->getEmailMessageId(), 'References' => $parent->getEmailReferences());
         }
         // Configure the reply tag and embedded message id token
         $mid_token = $options['thread']->asMessageId($to);
         if ($cfg && $cfg->stripQuotedReply() && (!isset($options['reply-tag']) || $options['reply-tag'])) {
             $reply_tag = $cfg->getReplySeparator() . '<br/><br/>';
         }
     }
     // Use general failsafe default initially
     $eol = "\n";
     // MAIL_EOL setting can be defined in `ost-config.php`
     if (defined('MAIL_EOL') && is_string(MAIL_EOL)) {
         $eol = MAIL_EOL;
     }
     $mime = new Mail_mime($eol);
     // If the message is not explicitly declared to be a text message,
     // then assume that it needs html processing to create a valid text
     // body
     $isHtml = true;
     if (!(isset($options['text']) && $options['text'])) {
         if ($reply_tag || $mid_token) {
             $message = "<div style=\"display:none\"\n                    class=\"mid-{$mid_token}\">{$reply_tag}</div>{$message}";
         }
         $txtbody = rtrim(Format::html2text($message, 90, false)) . ($mid_token ? "\nRef-Mid: {$mid_token}\n" : '');
         $mime->setTXTBody($txtbody);
     } else {
         $mime->setTXTBody($message);
         $isHtml = false;
     }
     if ($isHtml && $cfg && $cfg->isHtmlThreadEnabled()) {
         // Pick a domain compatible with pear Mail_Mime
         $matches = array();
         if (preg_match('#(@[0-9a-zA-Z\\-\\.]+)#', $this->getFromAddress(), $matches)) {
             $domain = $matches[1];
         } else {
             $domain = '@localhost';
         }
         // Format content-ids with the domain, and add the inline images
         // to the email attachment list
         $self = $this;
         $message = preg_replace_callback('/cid:([\\w.-]{32})/', function ($match) use($domain, $mime, $self) {
             if (!($file = AttachmentFile::lookup($match[1]))) {
                 return $match[0];
             }
             $mime->addHTMLImage($file->getData(), $file->getType(), $file->getName(), false, $match[1] . $domain);
             // Don't re-attach the image below
             unset($self->attachments[$file->getId()]);
             return $match[0] . $domain;
         }, $message);
         // Add an HTML body
         $mime->setHTMLBody($message);
     }
     //XXX: Attachments
     if ($attachments = $this->getAttachments()) {
         foreach ($attachments as $attachment) {
             if ($attachment['file_id'] && ($file = AttachmentFile::lookup($attachment['file_id']))) {
                 $mime->addAttachment($file->getData(), $file->getType(), $file->getName(), false);
             }
         }
     }
     //Desired encodings...
     $encodings = array('head_encoding' => 'quoted-printable', 'text_encoding' => 'base64', 'html_encoding' => 'base64', 'html_charset' => 'utf-8', 'text_charset' => 'utf-8', 'head_charset' => 'utf-8');
     //encode the body
     $body = $mime->get($encodings);
     //encode the headers.
     $headers = $mime->headers($headers, true);
     // Cache smtp connections made during this request
     static $smtp_connections = array();
     if ($smtp = $this->getSMTPInfo()) {
         //Send via SMTP
         $key = sprintf("%s:%s:%s", $smtp['host'], $smtp['port'], $smtp['username']);
         if (!isset($smtp_connections[$key])) {
             $mail = mail::factory('smtp', array('host' => $smtp['host'], 'port' => $smtp['port'], 'auth' => $smtp['auth'], 'username' => $smtp['username'], 'password' => $smtp['password'], 'timeout' => 20, 'debug' => false, 'persist' => true));
             if ($mail->connect()) {
                 $smtp_connections[$key] = $mail;
             }
         } else {
             // Use persistent connection
             $mail = $smtp_connections[$key];
         }
         $result = $mail->send($to, $headers, $body);
         if (!PEAR::isError($result)) {
             return $messageId;
         }
         // Force reconnect on next ->send()
         unset($smtp_connections[$key]);
         $alert = sprintf(__("Unable to email via SMTP:%1\$s:%2\$d [%3\$s]\n\n%4\$s\n"), $smtp['host'], $smtp['port'], $smtp['username'], $result->getMessage());
         $this->logError($alert);
     }
     //No SMTP or it failed....use php's native mail function.
     $mail = mail::factory('mail');
     return PEAR::isError($mail->send($to, $headers, $body)) ? false : $messageId;
 }
开发者ID:KM-MFG,项目名称:osTicket-1.8,代码行数:101,代码来源:class.mailer.php

示例8: sendIcalEvent

function sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location, $cal_method, $cal_unique_id)
{
    try {
        $domain = 'deltaintech.com';
        //Create Email Headers
        $mime_boundary = "----Meeting Booking----" . MD5(TIME());
        $headers = array("From" => $from_name . " <" . $from_address . ">", "Reply-To" => $from_name . " <" . $from_address . ">", "MIME-Version" => "1.0", "Content-Type" => "multipart/alternative; boundary=\"{$mime_boundary}\"", "Content-class" => "urn:content-classes:calendarmessage");
        //Create Email Body (HTML)
        $message = "--{$mime_boundary}\r\n";
        $message .= "Content-Type: text/html; charset=UTF-8\n";
        $message .= "Content-Transfer-Encoding: 8bit\n\n";
        $message .= "<html>\n";
        $message .= "<body>\n";
        $message .= '<p>Dear ' . $to_name . ',</p>';
        $message .= '<p>' . $description . '</p>';
        $message .= "</body>\n";
        $message .= "</html>\n";
        $message .= "--{$mime_boundary}\r\n";
        $ical = 'BEGIN:VCALENDAR' . "\r\n" . 'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" . 'VERSION:2.0' . "\r\n" . 'METHOD:' . $cal_method . "\r\n" . 'BEGIN:VTIMEZONE' . "\r\n" . 'TZID:(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi' . "\r\n" . 'BEGIN:STANDARD' . "\r\n" . 'DTSTART:20091101T020000' . "\r\n" . 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11' . "\r\n" . 'TZOFFSETFROM:-0400' . "\r\n" . 'TZOFFSETTO:-0500' . "\r\n" . 'TZNAME:EST' . "\r\n" . 'END:STANDARD' . "\r\n" . 'BEGIN:DAYLIGHT' . "\r\n" . 'DTSTART:20090301T020000' . "\r\n" . 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3' . "\r\n" . 'TZOFFSETFROM:-0500' . "\r\n" . 'TZOFFSETTO:-0400' . "\r\n" . 'TZNAME:EDST' . "\r\n" . 'END:DAYLIGHT' . "\r\n" . 'END:VTIMEZONE' . "\r\n" . 'BEGIN:VEVENT' . "\r\n" . 'ORGANIZER;CN="' . $from_name . '":MAILTO:' . $from_address . "\r\n" . 'ATTENDEE;CN="' . $to_name . '";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:' . $to_address . "\r\n" . 'LAST-MODIFIED:' . date("Ymd\\TGis") . "\r\n" . 'UID:' . $cal_unique_id . "\r\n" . 'DTSTAMP:' . date("Ymd\\TGis") . "\r\n" . 'DTSTART;TZID="(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi":' . date("Ymd\\THis", strtotime($startTime)) . "\r\n" . 'DTEND;TZID="(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi":' . date("Ymd\\THis", strtotime($endTime)) . "\r\n" . 'TRANSP:OPAQUE' . "\r\n" . 'SEQUENCE:1' . "\r\n" . 'SUMMARY:' . $subject . "\r\n" . 'LOCATION:' . $location . "\r\n" . 'CLASS:PUBLIC' . "\r\n" . 'PRIORITY:5' . "\r\n" . 'BEGIN:VALARM' . "\r\n" . 'TRIGGER:-PT15M' . "\r\n" . 'ACTION:DISPLAY' . "\r\n" . 'DESCRIPTION:Reminder' . "\r\n" . 'END:VALARM' . "\r\n" . 'END:VEVENT' . "\r\n" . 'END:VCALENDAR' . "\r\n";
        $message .= 'Content-Type: text/calendar;name="meeting.ics";method=' . $cal_method . "\n";
        $message .= "Content-Transfer-Encoding: 8bit\n\n";
        $message .= $ical;
        /* $smtp = Mail::factory('smtp', array(
           'host' => 'ssl://smtp.gmail.com',
           'port' => '465',
           'auth' => true,
           'username' => 'Deltaonesysadmin@deltaintech.com', //your gmail account
           'password' => 'Delta#123' // your password
           )); */
        $smtp = mail::factory('smtp', array('host' => MAIL_TLS . '://' . MAIL_SMTP, 'port' => MAIL_PORT, 'auth' => true, 'username' => MAIL_USERNAME, 'password' => MAIL_PASSWORD));
        $mailsent = $smtp->send($to_address, $headers, $message);
        if (!$mailsent) {
            $resultMsg = "Mailer Error: " . $mailsent->ErrorInfo;
        } else {
            //$resultMsg = $mailsent->getMessage();
            $resultMsg = "Email sent...!";
        }
        //return ($mailsent) ? (true) : (false);
    } catch (phpmailerException $e) {
        $resultMsg = $e->errorMessage();
    }
    return $resultMsg;
}
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:43,代码来源:sendemailcal.php

示例9: Validation

    $validate = new Validation();
    $validate = $validate->check($_POST, array('Username' => array('required' => true, 'min' => 4, 'max' => 25, 'unique' => 'users'), 'Password' => array('required' => true, 'min' => 6), 'ConfPassword' => array('required' => true, 'matches' => 'Password'), 'Email' => array('required' => true, 'unique' => 'users')));
    $data = array();
    $data['Success'] = false;
    if ($validate->passed()) {
        $user = new User();
        $emailHash = Hash::make($_POST['Email']);
        try {
            $user->create(array('Username' => $_POST['Username'], 'Password' => Hash::make($_POST['Password']), 'Email' => $_POST['Email'], 'Joined' => date('Y-m-d H:m:s'), 'Ehash' => $emailHash));
            $data['Success'] = true;
            require_once 'Mail.php';
            $from = 'deileo1994@gmail.com';
            $to = $_POST['Email'];
            $email = "Thank you for registering for DeckBuilder.\n In order to use our service activate your account http://localhost/DeckBuilder/BackEnd/LoginAndRegistrationActions/Activate.php?Ehash='" . $emailHash . "'";
            $subject = "Email vertification for DeckBuilder";
            $headers = array('from' => $from, 'to' => $to, 'subject' => $subject);
            $smtp = mail::factory('smtp', array('host' => 'ssl://smtp.gmail.com', 'port' => '465', 'auth' => true, 'username' => 'deileo1994@gmail.com', 'password' => 'monitorius25'));
            $mail = $smtp->send($to, $headers, $email);
            $data['Redirect'] = 'Index.php';
            //redirect to a page you want !
            echo json_encode($data);
        } catch (Exception $e) {
            die($e->getMessage());
        }
    } else {
        $data['Errors'] = $validate->Errors();
        $data['Success'] = false;
        echo json_encode($data);
    }
    //}
}
开发者ID:deileo,项目名称:DeckBuilder,代码行数:31,代码来源:Register.php

示例10: save

 function save($id, $vars, &$errors)
 {
     global $cfg;
     //very basic checks
     if ($id && $id != $vars['email_id']) {
         $errors['err'] = 'Error Interno.';
     }
     if (!$vars['email'] || !Validator::is_email($vars['email'])) {
         $errors['email'] = 'Se Requiere un Email Valido';
     } elseif (($eid = Email::getIdByEmail($vars['email'])) && $eid != $id) {
         $errors['email'] = 'Este Email ya existe';
     } elseif (!strcasecmp($cfg->getAdminEmail(), $vars['email'])) {
         $errors['email'] = 'Este Email ya se esta usando en la cuenta de Administrador';
     } else {
         //make sure the email doesn't belong to any of the staff
         $sql = 'SELECT staff_id FROM ' . STAFF_TABLE . ' WHERE email=' . db_input($vars['email']);
         if (($res = db_query($sql)) && db_num_rows($res)) {
             $errors['email'] = 'Este Email ya se esta usando por un miembro del Staff';
         }
     }
     if (!$vars['dept_id'] || !is_numeric($vars['dept_id'])) {
         $errors['dept_id'] = 'Debes seleccionar un Departamento';
     }
     if (!$vars['priority_id']) {
         $errors['priority_id'] = 'Debes seleccionar prioridad';
     }
     if ($vars['mail_active'] || $vars['smtp_active'] && $vars['smtp_auth']) {
         if (!$vars['userid']) {
             $errors['userid'] = 'Falta nombre de Usuario';
         }
         if (!$vars['userpass']) {
             $errors['userpass'] = 'Se Requiere una Contrase&ntilde;a';
         }
     }
     if ($vars['mail_active']) {
         //Check pop/imapinfo only when enabled.
         if (!function_exists('imap_open')) {
             $errors['mail_active'] = 'IMAP no existe. PHP debe ser compilado con IMAP.';
         }
         if (!$vars['mail_host']) {
             $errors['mail_host'] = 'Se requiere nombre del Host';
         }
         if (!$vars['mail_port']) {
             $errors['mail_port'] = 'Se requiere numero de Puerto';
         }
         if (!$vars['mail_protocol']) {
             $errors['mail_protocol'] = 'Selecciona Protocolo';
         }
         if (!$vars['mail_fetchfreq'] || !is_numeric($vars['mail_fetchfreq'])) {
             $errors['mail_fetchfreq'] = 'Se requiere frecuencia de captura';
         }
         if (!$vars['mail_fetchmax'] || !is_numeric($vars['mail_fetchmax'])) {
             $errors['mail_fetchmax'] = 'Se requiere numero m&aacute;ximo de correos por captura';
         }
     }
     if ($vars['smtp_active']) {
         if (!$vars['smtp_host']) {
             $errors['smtp_host'] = 'Se requiere nombre del Host';
         }
         if (!$vars['smtp_port']) {
             $errors['smtp_port'] = 'Se requiere numero de puerto';
         }
     }
     if (!$errors && ($vars['mail_host'] && $vars['userid'])) {
         $sql = 'SELECT email_id FROM ' . EMAIL_TABLE . ' WHERE mail_host=' . db_input($vars['mail_host']) . ' AND userid=' . db_input($vars['userid']);
         if ($id) {
             $sql .= ' AND email_id!=' . db_input($id);
         }
         if (db_num_rows(db_query($sql))) {
             $errors['userid'] = $errors['host'] = 'La combinacion Host/Nombre de usuario ya esta en uso por otro departamento.';
         }
     }
     if (!$errors && $vars['mail_active']) {
         //note: password is unencrypted at this point...MailFetcher expect plain text.
         $fetcher = new MailFetcher($vars['userid'], $vars['userpass'], $vars['mail_host'], $vars['mail_port'], $vars['mail_protocol'], $vars['mail_encryption']);
         if (!$fetcher->connect()) {
             $errors['userpass'] = '<br>No se a podido establecer una conexi&oacute;n, revisa la configuraci&oacute;n de' . $vars['mail_protocol'] . '';
             $errors['mail'] = '<br>' . $fetcher->getLastError();
         }
     }
     if (!$errors && $vars['smtp_active']) {
         //Check SMTP login only.
         require_once 'Mail.php';
         // PEAR Mail package
         $smtp = mail::factory('smtp', array('host' => $vars['smtp_host'], 'port' => $vars['smtp_port'], 'auth' => $vars['smtp_auth'] ? true : false, 'username' => $vars['userid'], 'password' => $vars['userpass'], 'timeout' => 20, 'debug' => false));
         $mail = $smtp->connect();
         if (PEAR::isError($mail)) {
             $errors['userpass'] = '<br>No se a podido establecer una conexi&oacute;n, revisa la configuraci&oacute;n de SMTP.';
             $errors['smtp'] = '<br>' . $mail->getMessage();
         } else {
             $smtp->disconnect();
             //Thank you, sir!
         }
     }
     if (!$errors) {
         $sql = 'updated=NOW(),mail_errors=0, mail_lastfetch=NULL' . ',email=' . db_input($vars['email']) . ',name=' . db_input(Format::striptags($vars['name'])) . ',dept_id=' . db_input($vars['dept_id']) . ',priority_id=' . db_input($vars['priority_id']) . ',noautoresp=' . db_input(isset($vars['noautoresp']) ? 1 : 0) . ',userid=' . db_input($vars['userid']) . ',userpass=' . db_input(Misc::encrypt($vars['userpass'], SECRET_SALT)) . ',mail_active=' . db_input($vars['mail_active']) . ',mail_host=' . db_input($vars['mail_host']) . ',mail_protocol=' . db_input($vars['mail_protocol'] ? $vars['mail_protocol'] : 'POP') . ',mail_encryption=' . db_input($vars['mail_encryption']) . ',mail_port=' . db_input($vars['mail_port'] ? $vars['mail_port'] : 0) . ',mail_fetchfreq=' . db_input($vars['mail_fetchfreq'] ? $vars['mail_fetchfreq'] : 0) . ',mail_fetchmax=' . db_input($vars['mail_fetchmax'] ? $vars['mail_fetchmax'] : 0) . ',mail_delete=' . db_input(isset($vars['mail_delete']) ? $vars['mail_delete'] : 0) . ',smtp_active=' . db_input($vars['smtp_active']) . ',smtp_host=' . db_input($vars['smtp_host']) . ',smtp_port=' . db_input($vars['smtp_port'] ? $vars['smtp_port'] : 0) . ',smtp_auth=' . db_input($vars['smtp_auth']);
         if ($id) {
             //update
             $sql = 'UPDATE ' . EMAIL_TABLE . ' SET ' . $sql . ' WHERE email_id=' . db_input($id);
             if (!db_query($sql) || !db_affected_rows()) {
//.........这里部分代码省略.........
开发者ID:e-gob,项目名称:chilesinpapeleo-soporte,代码行数:101,代码来源:class.email.php


注:本文中的mail::factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。