1

我的情况如下:

我使用 ubercart 并安装了 3 个模块用于电子邮件(当客户进行购买时)确认购买。这些模块是:SMTP、MIMEMail 和 HTML MAIL。验证、发送适用于 HTML。但是,当产品过期时,我需要发送另一种类型的电子邮件。而我正在使用我自己的模块。但是,当我使用 drupal_mail 或 drupal_mail_send 的功能时,发送不正确。当我调试该功能时,显然一切都是正确的,但我没有收到任何电子邮件。

我的函数代码是 drupal_mail_send:

$message = array(
    'to' => $to,
    'from' => $from,
    'id' => 'cuponalcubo_mailing',
    'subject' => $subject,
    'body' => $body,
    'headers' => array(
        'MIME-Version' => '1.0',
        'Content-Type' => 'text/html; charset=UTF-8; format=flowed; delsp=yes',
        'Content-Transfer-Encoding' => '8Bit',
        'X-Mailer' => 'Pressflow',
    )
);
drupal_mail_send($message);

该函数的代码是drupal_mail:

function ....(){
$params = array(
        'subject' => $subject,
        'body' => t($body)
    );
    drupal_mail('email_deal_vp', 'email_deal_vp_html_mail', $to, language_default(), $params, $from);
}

/*
 * Implements HOOK_MAIL
 */
function email_deal_vp_mail($key, &$message, $params) {
    $language = $message['language'];
    switch ($key) {
        case 'email_deal_vp_html_mail':
            $message['subject'] = t($params['subject'], $var, $language->language);
              $body = "<html><body>
                  {$params['body']}
                  </body></html>";
              $message['body'][] = $body;
              $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
              break;
    }
}
4

1 回答 1

0

Maybe this is a problem with your server (SMTP is not configured properly). Check with any existing mail code whether it is working. (If it was working before.)

于 2012-09-06T09:07:00.663 回答