php mail() 和阿鲁巴岛?

发布于 2024-12-11 18:21:15 字数 3696 浏览 0 评论 0原文

早上好,

遗憾的是我必须使用 aruba.it 做一个网站,我遇到了一个大问题,在使用 mail() 命令发送 html 邮件时,使用一些服务器(例如 gmail),邮件直接进入垃圾文件夹,我检查了标题,对我来说似乎很好,所以...出于想法(和时间),我来这里寻求帮助 XD。在下面,您可以看到带有标题的发送邮件的来源。

    Delivered-To: [email protected]
    Received: by 10.68.50.233 with SMTP id f9cs182962pbo;
    Wed, 26 Oct 2011 07:00:41 -0700 (PDT)
    Received: by 10.227.197.197 with SMTP id el5mr9931909wbb.26.1319637640301;
    Wed, 26 Oct 2011 07:00:40 -0700 (PDT)
    Return-Path: <[email protected]>
    Received: from smtpsmart1.aruba.it (smtpweb120.aruba.it. [62.149.158.120])
    by mx.google.com with SMTP id em13si1304523wbb.129.2011.10.26.07.00.39;
    Wed, 26 Oct 2011 07:00:40 -0700 (PDT)
    Received-SPF: pass (google.com: domain of [email protected] designates 62.149.158.120 as permitted sender) client-ip=62.149.158.120;
    Authentication-Results: mx.google.com; spf=pass (google.com: domain of [email protected] designates 62.149.158.120 as permitted sender)        [email protected]
    Received: (qmail 23053 invoked by uid 89); 26 Oct 2011 14:00:38 -0000
    Received: by simscan 1.2.0 ppid: 22702, pid: 22713, t: 1.4573s
    scanners: clamav: 0.88.4/m:40/d:1945 spam: 3.1.4
    X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
    smtpsmart1.fe.aruba.it
    X-Spam-Level: **
    X-Spam-Status: No, score=2.0 required=6.0 tests=BAYES_50,MIME_HTML_ONLY,
    RDNS_NONE autolearn=disabled version=3.2.5
    Received: from unknown (HELO webxc25s08.ad.aruba.it) (62.149.143.48)
    by smtpsmart1.fe.aruba.it with SMTP; 26 Oct 2011 14:00:36 -0000
    Received: (qmail 29688 invoked by uid 18945188); 26 Oct 2011 14:00:36 -0000
    Date: 26 Oct 2011 14:00:36 -0000
    Message-ID: <[email protected]>
    To: [email protected]
    Subject: Registrazione somesite.com
    MIME-Version: 1.0
    Content-type: text/html; charset=iso-8859-1
    To: nreguser6 creuser6 <[email protected]>
    From: Admin <[email protected]>


  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <html>
  <head>
   <title></title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
   Benvenuto Utente nuovo
   <a   href="http://somesite.com/registrazione/attivazione/code/XXMS8ADzT1CJqZLMgmRBYA7nP">Attiva</a>
  </body>
</html>

如果您有任何关于如何解决它的想法,我将不胜感激!谢谢!

goodmorning,

sadly i have to do a website using aruba.it and i encountered a big problem, while using the mail() command to send an html mail, with some server like gmail the mail goes directly to the junk folder, i checked the headers and seems fine to me so... out of idea(and time) i'm here to ask for help XD. here under you can see the source of the mail sent with the header..

    Delivered-To: [email protected]
    Received: by 10.68.50.233 with SMTP id f9cs182962pbo;
    Wed, 26 Oct 2011 07:00:41 -0700 (PDT)
    Received: by 10.227.197.197 with SMTP id el5mr9931909wbb.26.1319637640301;
    Wed, 26 Oct 2011 07:00:40 -0700 (PDT)
    Return-Path: <[email protected]>
    Received: from smtpsmart1.aruba.it (smtpweb120.aruba.it. [62.149.158.120])
    by mx.google.com with SMTP id em13si1304523wbb.129.2011.10.26.07.00.39;
    Wed, 26 Oct 2011 07:00:40 -0700 (PDT)
    Received-SPF: pass (google.com: domain of [email protected] designates 62.149.158.120 as permitted sender) client-ip=62.149.158.120;
    Authentication-Results: mx.google.com; spf=pass (google.com: domain of [email protected] designates 62.149.158.120 as permitted sender)        [email protected]
    Received: (qmail 23053 invoked by uid 89); 26 Oct 2011 14:00:38 -0000
    Received: by simscan 1.2.0 ppid: 22702, pid: 22713, t: 1.4573s
    scanners: clamav: 0.88.4/m:40/d:1945 spam: 3.1.4
    X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
    smtpsmart1.fe.aruba.it
    X-Spam-Level: **
    X-Spam-Status: No, score=2.0 required=6.0 tests=BAYES_50,MIME_HTML_ONLY,
    RDNS_NONE autolearn=disabled version=3.2.5
    Received: from unknown (HELO webxc25s08.ad.aruba.it) (62.149.143.48)
    by smtpsmart1.fe.aruba.it with SMTP; 26 Oct 2011 14:00:36 -0000
    Received: (qmail 29688 invoked by uid 18945188); 26 Oct 2011 14:00:36 -0000
    Date: 26 Oct 2011 14:00:36 -0000
    Message-ID: <[email protected]>
    To: [email protected]
    Subject: Registrazione somesite.com
    MIME-Version: 1.0
    Content-type: text/html; charset=iso-8859-1
    To: nreguser6 creuser6 <[email protected]>
    From: Admin <[email protected]>


  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <html>
  <head>
   <title></title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
   Benvenuto Utente nuovo
   <a   href="http://somesite.com/registrazione/attivazione/code/XXMS8ADzT1CJqZLMgmRBYA7nP">Attiva</a>
  </body>
</html>

if you have any idea about how to resolve it i'll appreciate!!!! Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心在旅行 2024-12-18 18:21:15

ARUBA 不鼓励使用 mail() 并鼓励使用 PHPMailer。但是,您可以使用下面的代码来调整您需要的部分,以便测试和解决您的问题。

<?php

error_reporting(E_ALL);

// Generates boundary
$mail_boundary = "=_NextPart_" . md5(uniqid(time()));

$to = "[email protected]";
$subject = "testing e-mail";
$sender = "[email protected]";


$headers = "From: $sender\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative;\n\tboundary=\"$mail_boundary\"\n";
$headers .= "X-Mailer: PHP " . phpversion();

// Messaage bodies: TXT and HTML
$text_msg = "messaggio in formato testo";
$html_msg = "<b>messaggio</b> in formato <p><a href='http://www.aruba.it'>html</a><br><img src=\"http://hosting.aruba.it/image_top/top_01.gif\" border=\"0\"></p>";

// Build up the message's body to be sent
$msg = "This is a multi-part message in MIME format.\n\n";
$msg .= "--$mail_boundary\n";
$msg .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: 8bit\n\n";
$msg .= "This is a testing e-mail sent by FORPSI Webhosting user for PHP mail()function testing purposes. FORPSI";  // text format message

$msg .= "\n--$mail_boundary\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: 8bit\n\n";
$msg .= "This is a testing e-mail sent by FORPSI Webhosting user for PHP mail()function testing purposes.

FORPSI";  // HTML format text

// Ending Boundary multipart/alternative
$msg .= "\n--$mail_boundary--\n";

// Return-Path setup (to be used only on windows servers)
ini_set("sendmail_from", $sender);

// Send the message, the fifth paramter set the Return-Path "-f$sender" on Linux Hosting
if (mail($to, $subject, $msg, $headers, "-f$sender")) { 
    echo "Mail sent successfully !<br><br>This is the source code used for sending the e-mail:<br><br>";
    highlight_file($_SERVER["SCRIPT_FILENAME"]);
    unlink($_SERVER["SCRIPT_FILENAME"]);
} else { 
    echo "<br><br>Mail delivery failed!";
}

?>

ARUBA discourages to use mail() and encourage to use PHPMailer instead. However, you can use the code below adapting the parts you need, in order to test and to solve your issue.

<?php

error_reporting(E_ALL);

// Generates boundary
$mail_boundary = "=_NextPart_" . md5(uniqid(time()));

$to = "[email protected]";
$subject = "testing e-mail";
$sender = "[email protected]";


$headers = "From: $sender\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative;\n\tboundary=\"$mail_boundary\"\n";
$headers .= "X-Mailer: PHP " . phpversion();

// Messaage bodies: TXT and HTML
$text_msg = "messaggio in formato testo";
$html_msg = "<b>messaggio</b> in formato <p><a href='http://www.aruba.it'>html</a><br><img src=\"http://hosting.aruba.it/image_top/top_01.gif\" border=\"0\"></p>";

// Build up the message's body to be sent
$msg = "This is a multi-part message in MIME format.\n\n";
$msg .= "--$mail_boundary\n";
$msg .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: 8bit\n\n";
$msg .= "This is a testing e-mail sent by FORPSI Webhosting user for PHP mail()function testing purposes. FORPSI";  // text format message

$msg .= "\n--$mail_boundary\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: 8bit\n\n";
$msg .= "This is a testing e-mail sent by FORPSI Webhosting user for PHP mail()function testing purposes.

FORPSI";  // HTML format text

// Ending Boundary multipart/alternative
$msg .= "\n--$mail_boundary--\n";

// Return-Path setup (to be used only on windows servers)
ini_set("sendmail_from", $sender);

// Send the message, the fifth paramter set the Return-Path "-f$sender" on Linux Hosting
if (mail($to, $subject, $msg, $headers, "-f$sender")) { 
    echo "Mail sent successfully !<br><br>This is the source code used for sending the e-mail:<br><br>";
    highlight_file($_SERVER["SCRIPT_FILENAME"]);
    unlink($_SERVER["SCRIPT_FILENAME"]);
} else { 
    echo "<br><br>Mail delivery failed!";
}

?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文