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


PHP Mail_mime::txtHeaders方法代码示例

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


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

示例1: sendEmailViaAmazon

 public function sendEmailViaAmazon($title, $body, $args)
 {
     $mail_mime = new Mail_mime();
     $mail_mime->setHTMLBody($body);
     $body = $mail_mime->get();
     $headers = $mail_mime->txtHeaders(array('From' => 'Comnovo Web Service<' . SERVICE_EMAIL . '>', 'Reply-To' => SERVICE_EMAIL, 'Subject' => "{$title}"));
     $message = $headers . "\r\n" . $body;
     $sendResult = $this->emailConnetHandler->send_raw_email(array('Data' => base64_encode($message)), array('Destinations' => $args['user_email']));
     if ($sendResult->isOK()) {
         print "Mail sent; message id is " . (string) $sendResult->body->SendRawEmailResult->MessageId . "\n";
     } else {
         print "Mail not sent; error is " . (string) $sendResult->body->Error->Message . "\n";
     }
 }
开发者ID:Rming,项目名称:novophp,代码行数:14,代码来源:ResetPasswordEmail_Job.php

示例2: array

    $from = idn_to_ascii(trim($_POST['_from']));
    $to = idn_to_ascii(trim($_POST['_to']));
    if (preg_match('/^' . $RCI->email_pattern . '$/i', $from) && preg_match('/^' . $RCI->email_pattern . '$/i', $to)) {
        $headers = array('From' => $from, 'To' => $to, 'Subject' => 'Test message from Roundcube');
        $body = 'This is a test to confirm that Roundcube can send email.';
        // send mail using configured SMTP server
        $CONFIG = $RCI->config;
        if (!empty($_POST['_smtp_user'])) {
            $CONFIG['smtp_user'] = $_POST['_smtp_user'];
        }
        if (!empty($_POST['_smtp_pass'])) {
            $CONFIG['smtp_pass'] = $_POST['_smtp_pass'];
        }
        $mail_object = new Mail_mime();
        $send_headers = $mail_object->headers($headers);
        $head = $mail_object->txtHeaders($send_headers);
        $SMTP = new rcube_smtp();
        $SMTP->connect(rcube_utils::parse_host($RCI->getprop('smtp_server')), $RCI->getprop('smtp_port'), $CONFIG['smtp_user'], $CONFIG['smtp_pass']);
        $status = $SMTP->send_mail($headers['From'], $headers['To'], $head, $body);
        $smtp_response = $SMTP->get_response();
        if ($status) {
            $RCI->pass('SMTP send');
        } else {
            $RCI->fail('SMTP send', join('; ', $smtp_response));
        }
    } else {
        $RCI->fail('SMTP send', 'Invalid sender or recipient');
    }
    echo '</p>';
}
?>
开发者ID:jimjag,项目名称:roundcubemail,代码行数:31,代码来源:test.php

示例3: array

 $body = 'This is a test to confirm that Roundcube can send email.';
 $smtp_response = array();
 // send mail using configured SMTP server
 if ($RCI->getprop('smtp_server')) {
     $CONFIG = $RCI->config;
     if (!empty($_POST['_smtp_user'])) {
         $CONFIG['smtp_user'] = $_POST['_smtp_user'];
     }
     if (!empty($_POST['_smtp_pass'])) {
         $CONFIG['smtp_pass'] = $_POST['_smtp_pass'];
     }
     $mail_object = new Mail_mime();
     $send_headers = $mail_object->headers($headers);
     $SMTP = new rcube_smtp();
     $SMTP->connect(rcube_parse_host($RCI->getprop('smtp_server')), $RCI->getprop('smtp_port'), $CONFIG['smtp_user'], $CONFIG['smtp_pass']);
     $status = $SMTP->send_mail($headers['From'], $headers['To'], $foo = $mail_object->txtHeaders($send_headers), $body);
     $smtp_response = $SMTP->get_response();
 } else {
     // use mail()
     $header_str = 'From: ' . $headers['From'];
     if (ini_get('safe_mode')) {
         $status = mail($headers['To'], $headers['Subject'], $body, $header_str);
     } else {
         $status = mail($headers['To'], $headers['Subject'], $body, $header_str, '-f' . $headers['From']);
     }
     if (!$status) {
         $smtp_response[] = 'Mail delivery with mail() failed. Check your error logs for details';
     }
 }
 if ($status) {
     $RCI->pass('SMTP send');
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:test.php

示例4: Exception

    //------------------------------------------------------------------------------
    $mime = new Mail_mime();
    // method 'addTo' exists in Mail_Mime-1.8.0+
    if (method_exists('Mail_mime', 'addTo')) {
        $mime->addTo($to);
    }
    $mime->setFrom($from);
    $mime->setSubject($subject);
    //$mime->addCc($cc);
    $mime->setTxtBody($body_text);
    //$mime->setHTMLBody($body_html);
    //------------------------------------------------------------------------------
    // get() must be called before headers()
    $body = $mime->get();
    // headers() must be called after get()
    $headers = $mime->txtHeaders();
    //$headers = $mime->headers();
    //------------------------------------------------------------------------------
    // send the problem
    if (!mail($to, $subject, $body, $headers)) {
        throw new Exception('"mail" function failed.');
    }
    $tmp1 = $e->getMessage();
    print <<<EOT
<p>There was an error.  Your results were <b>not</b> submitted.</p>

<p>The problem has been reported.</p>

<blockquote><p>{$tmp1}</p></blockquote>
EOT;
    unset($tmp1);
开发者ID:grevutiu-gabriel,项目名称:iqatest,代码行数:31,代码来源:submit-results.php


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