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


PHP Mail::set_sender方法代码示例

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


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

示例1: Mail

 function test_accessor_sender()
 {
     $msg = new Mail();
     $mail = 'test@test.fr';
     $msg->set_sender($mail);
     self::assertEquals($mail, $msg->get_sender_mail());
     self::assertEquals($msg->sender_name, $msg->get_sender_name());
     $mail = 'test@test.fr';
     $name = 'sender';
     $msg->set_sender($mail, $name);
     self::assertEquals($mail, $msg->get_sender_mail());
     self::assertEquals($msg->sender_name, $msg->get_sender_name());
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:13,代码来源:MailTest.php

示例2: testBasicMailConversion

 public function testBasicMailConversion()
 {
     $mail = new Mail();
     $mail->add_recipient('toto@site.com', 'Toto');
     $mail->set_sender('tata@site.com', 'Tata');
     $mail->set_content('hello world');
     $mail->set_subject('hello');
     $converter = new MailToPHPMailerConverter();
     $phpmailer = $converter->convert($mail);
     self::assertEquals('hello', $phpmailer->Subject);
     self::assertEquals('hello world', $phpmailer->Body);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:12,代码来源:MailToPHPMailerConverterTest.php

示例3: send_from_properties

 public function send_from_properties($mail_to, $mail_subject, $mail_content, $mail_from = '', $sender_name = Mail::SENDER_ADMIN)
 {
     // Initialization of the mail properties
     $mail = new Mail();
     $mail->add_recipient($mail_to);
     if ($mail_from == '') {
         $mail_from = MailServiceConfig::load()->get_default_mail_sender();
     }
     $mail->set_sender($mail_from, $sender_name);
     $mail->set_subject($mail_subject);
     $mail->set_content($mail_content);
     // Let's send the mail
     return $this->try_to_send($mail);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:14,代码来源:AbstractPHPMailerMailService.class.php

示例4: send_mail

 public function send_mail($subscribers, $sender, $subject, $contents)
 {
     $contents = $this->parse_contents($contents) . $this->add_unsubscribe_link();
     foreach ($subscribers as $values) {
         $mail_subscriber = !empty($values['mail']) ? $values['mail'] : NewsletterDAO::get_mail_for_member($values['user_id']);
         if (!empty($mail_subscriber)) {
             $mail = new Mail();
             $mail->set_sender($sender);
             $mail->set_is_html(true);
             $mail->set_subject($subject);
             $mail->set_content($contents);
             $mail->add_recipient($mail_subscriber);
             //TODO gestion des erreurs
             AppContext::get_mail_service()->try_to_send($mail);
         }
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:17,代码来源:TextNewsletterMail.class.php

示例5: substr

     $unlock_admin = substr(strhash(uniqid(mt_rand(), true)), 0, 12);
     $CONFIG['unlock_admin'] = strhash($unlock_admin);
     $CONFIG['mail_exp'] = $user_mail;
     $CONFIG['mail'] = $user_mail;
     $Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($CONFIG)) . "' WHERE name = 'config'", __LINE__, __FILE__);
     $Cache->Generate_file('config');
     $Cache->load('member');
     $CONFIG_USER['activ_register'] = (int) DISTRIBUTION_ENABLE_USER;
     $CONFIG_USER['msg_mbr'] = $LANG['site_config_msg_mbr'];
     $CONFIG_USER['msg_register'] = $LANG['site_config_msg_register'];
     $Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($CONFIG_USER)) . "' WHERE name = 'member'", __LINE__, __FILE__);
     $Cache->generate_file('member');
     $LANG['admin'] = '';
     import('io/mail');
     $mail = new Mail();
     $mail->set_sender('admin');
     $mail->set_recipients($user_mail);
     $mail->set_object($LANG['admin_mail_object']);
     $mail->set_content(sprintf($LANG['admin_mail_unlock_code'], stripslashes($login), stripslashes($login), $password, $unlock_admin, HOST . DIR));
     $mail->send();
     if ($create_session) {
         import('members/session');
         $Session = new Session();
         $Sql->query_inject("UPDATE " . DB_TABLE_MEMBER . " SET last_connect='" . time() . "' WHERE user_id = '1'", __LINE__, __FILE__);
         $Session->start(1, $password, 2, '/install/install.php', '', $LANG['page_title'], $auto_connection);
     }
     $Cache->generate_file('stats');
     redirect(HOST . FILE . add_lang('?step=' . (STEP_ADMIN_ACCOUNT + 1), true));
 } else {
     $template->assign_block_vars('error', array('ERROR' => '<div class="warning">' . $error . '</div>'));
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:install.php

示例6: array

 function send_text($mail_object, $message, $email_test = '')
 {
     global $_NEWSLETTER_CONFIG, $LANG, $Sql;
     $error_mailing_list = array();
     $header = 'From: ' . $_NEWSLETTER_CONFIG['newsletter_name'] . ' <' . $_NEWSLETTER_CONFIG['sender_mail'] . '>' . "\r\n";
     $header .= 'Reply-To: ' . $_NEWSLETTER_CONFIG['sender_mail'] . "\r\n";
     if ($email_test == '') {
         $nbr = $Sql->count_table('newsletter', __LINE__, __FILE__);
         $Sql->query_inject("INSERT INTO " . PREFIX . "newsletter_arch (title,message,timestamp,type,nbr) VALUES('" . strprotect($mail_object, HTML_NO_PROTECT, ADDSLASHES_FORCE) . "', '" . strprotect($message, HTML_NO_PROTECT, ADDSLASHES_FORCE) . "', '" . time() . "', 'text', '" . $nbr . "')", __LINE__, __FILE__);
         $mailing_list = array();
         $result = $Sql->query_while("SELECT id, mail \n\t\t\tFROM " . PREFIX . "newsletter \n\t\t\tORDER BY id", __LINE__, __FILE__);
         while ($row = $Sql->fetch_assoc($result)) {
             $mailing_list[] = array($row['id'], $row['mail']);
         }
         $Sql->query_close($result);
         $mail_sender = new Mail();
         $mail_sender->set_sender($_NEWSLETTER_CONFIG['sender_mail']);
         $mail_sender->set_mime(MIME_FORMAT_TEXT);
         $mail_sender->set_object($mail_object);
         foreach ($mailing_list as $array_mail) {
             $mail_sender->set_recipients($array_mail[1]);
             $mail_sender->set_content($message . "\n\n" . $LANG['newsletter_unscubscribe_text'] . HOST . DIR . '/newsletter/newsletter.php?id=' . $array_mail[0]);
             if (!$mail_sender->send()) {
                 $error_mailing_list[] = $array_mail[1];
             }
         }
         return $error_mailing_list;
     } else {
         $mail_sender = new Mail();
         $mail_sender->set_sender($_NEWSLETTER_CONFIG['sender_mail']);
         $mail_sender->set_mime(MIME_FORMAT_HTML);
         $mail_sender->set_recipients($email_test);
         $mail_sender->set_content($message);
         $mail_sender->set_object($mail_object);
         $mail_sender->send();
         return true;
     }
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:38,代码来源:newsletter_service.class.php

示例7: send_mail

    private function send_mail()
    {
        $message = '';
        $current_user = AppContext::get_current_user();
        $fields = $this->config->get_fields();
        $recipients_field_id = $this->config->get_field_id_by_name('f_recipients');
        $recipients_field = new ContactField();
        $recipients_field->set_properties($fields[$recipients_field_id]);
        $recipients = $recipients_field->get_possible_values();
        $recipients['admins']['email'] = implode(';', MailServiceConfig::load()->get_administrators_mails());
        $subject_field_id = $this->config->get_field_id_by_name('f_subject');
        $subject_field = new ContactField();
        $subject_field->set_properties($fields[$subject_field_id]);
        $subjects = $subject_field->get_possible_values();
        if ($subject_field->get_field_type() == 'ContactShortTextField') {
            $subject = $this->form->get_value('f_subject');
        } else {
            $subject = $this->form->get_value('f_subject')->get_raw_value();
        }
        $display_message_title = false;
        if ($this->config->is_tracking_number_enabled()) {
            $now = new Date();
            $tracking_number = $this->config->get_last_tracking_number();
            $tracking_number++;
            $message .= $this->lang['contact.tracking_number'] . ' : ' . ($this->config->is_date_in_tracking_number_enabled() ? $now->get_year() . $now->get_month() . $now->get_day() . '-' : '') . $tracking_number . '

';
            $this->config->set_last_tracking_number($tracking_number);
            ContactConfig::save();
            $subject = '[' . $tracking_number . '] ' . $subject;
            $display_message_title = true;
        }
        foreach ($this->config->get_fields() as $id => $properties) {
            $field = new ContactField();
            $field->set_properties($properties);
            if ($field->is_displayed() && $field->is_authorized() && $field->is_deletable()) {
                try {
                    $value = ContactFieldsService::get_value($this->form, $field);
                    $message .= $field->get_name() . ': ' . $value . '

';
                } catch (Exception $e) {
                    throw new Exception($e->getMessage());
                }
                $display_message_title = true;
            }
        }
        if ($display_message_title) {
            $message .= $this->lang['contact.form.message'] . ':
';
        }
        $message .= $this->form->get_value('f_message');
        $mail = new Mail();
        $mail->set_sender(MailServiceConfig::load()->get_default_mail_sender(), $this->lang['module_title']);
        $mail->set_reply_to($this->form->get_value('f_sender_mail'), $current_user->get_level() == User::VISITOR_LEVEL ? $this->lang['module_title'] : $current_user->get_display_name());
        $mail->set_subject($subject);
        $mail->set_content($message);
        if ($recipients_field->is_displayed()) {
            if (in_array($recipients_field->get_field_type(), array('ContactSimpleSelectField', 'ContactSimpleChoiceField'))) {
                $recipients_mails = explode(';', $recipients[$this->form->get_value('f_recipients')->get_raw_value()]['email']);
            } else {
                $selected_recipients = $this->form->get_value('f_recipients');
                $recipients_mails = array();
                foreach ($selected_recipients as $recipient) {
                    $mails = explode(';', $recipients[$recipient->get_id()]['email']);
                    foreach ($mails as $m) {
                        $recipients_mails[] = $m;
                    }
                }
            }
            foreach ($recipients_mails as $mail_address) {
                $mail->add_recipient($mail_address);
            }
        } else {
            if ($subject_field->get_field_type() != 'ContactShortTextField') {
                $recipient = $subjects[$this->form->get_value('f_subject')->get_raw_value()]['recipient'];
                $recipients_mails = explode(';', $recipients[$recipient]['email']);
                foreach ($recipients_mails as $mail_address) {
                    $mail->add_recipient($mail_address);
                }
            } else {
                $recipients_mails = explode(';', $recipients['admins']['email']);
                foreach ($recipients_mails as $mail_address) {
                    $mail->add_recipient($mail_address);
                }
            }
        }
        $mail_service = AppContext::get_mail_service();
        if ($this->config->is_sender_acknowledgment_enabled()) {
            $acknowledgment = new Mail();
            $acknowledgment->set_sender(MailServiceConfig::load()->get_default_mail_sender(), Mail::SENDER_ADMIN);
            $acknowledgment->set_subject('[' . $this->lang['contact.acknowledgment_title'] . '] ' . $subject);
            $acknowledgment->set_content($this->lang['contact.acknowledgment'] . $message);
            $acknowledgment->add_recipient($this->form->get_value('f_sender_mail'));
            return $mail_service->try_to_send($mail) && $mail_service->try_to_send($acknowledgment);
        }
        return $mail_service->try_to_send($mail);
    }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:98,代码来源:ContactController.class.php

示例8: send_mail

 private function send_mail()
 {
     if ($this->form->get_value('use_smtp')) {
         $configuration = new SMTPConfiguration();
         $configuration->set_host($this->form->get_value('smtp_host'));
         $configuration->set_port($this->form->get_value('smtp_port'));
         $configuration->set_login($this->form->get_value('smtp_login'));
         $configuration->set_password($this->form->get_value('smtp_password'));
         $configuration->set_auth_mode($this->form->get_value('secure_protocol')->get_raw_value());
         $mailer = new SMTPMailService($configuration);
     } else {
         $mailer = new DefaultMailService();
     }
     $mail = new Mail();
     $mail->add_recipient($this->form->get_value('recipient_mail'), $this->form->get_value('recipient_name'));
     $mail->set_sender($this->form->get_value('sender_mail'), $this->form->get_value('sender_name'));
     $mail->set_subject($this->form->get_value('mail_subject'));
     $mail->set_content($this->form->get_value('mail_content'));
     return $mailer->send($mail);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:20,代码来源:SandboxMailController.class.php


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