Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用html自定义Php邮件_Php_Html_Email - Fatal编程技术网

使用html自定义Php邮件

使用html自定义Php邮件,php,html,email,Php,Html,Email,我想用一些html自定义一封php电子邮件,但我正在努力 提交表格后,我收到了电子邮件,但发生了 我一直在关注这个 我把我用过的密码放进去了 $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Alright, lets send the email already! if ( empty( $errorString )

我想用一些html自定义一封php电子邮件,但我正在努力

提交表格后,我收到了电子邮件,但发生了

我一直在关注这个

我把我用过的密码放进去了

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Alright, lets send the email already!
if ( empty( $errorString ) ) {

    $mailbody .= '<html><body>';
    $mailbody .= '<img src="//http://xxxx/xxxxx/wp-content/uploads/2015/06/email.jpg" alt="Website Change Request" />';
    $mailbody .= '<table rules="all" style="border-color: #666;" cellpadding="10">';

    $mailbody .= __('Nome:', 'ci_theme' ) . ' ' . $clientname . "\n";
    $mailbody .= __('Email:', 'ci_theme' ) . ' ' . $email . "\n";
    $mailbody .= __('Chegada:', 'ci_theme' ) . ' ' . $arrive . "\n";
    $mailbody .= __('Saída:', 'ci_theme' ) . ' ' . $depart . "\n";
    $mailbody .= __('Adultos:', 'ci_theme' ) . ' ' . $guests . "\n";
    $mailbody .= __('Crianças:', 'ci_theme' ) . ' ' . $children . "\n";
    $mailbody .= __('Quarto:', 'ci_theme' ) . ' ' . $room->post_title . "\n";
    $mailbody .= __('Mensagem:', 'ci_theme' ) . ' ' . $message . "\n";
    $mailbody .= __('Hora do Check-in (hh:mm):', 'ci_theme' ) . ' ' . $timeguest . "\n";
    $mailbody .= __('Contacto:', 'ci_theme' ) . ' ' . $contactguest . "\n";
    $mailbody .= __('Autorização:', 'ci_theme' ) . ' ' . $autorizo . "\n";
    $mailbody .= __('Cama Extra:', 'ci_theme' ) . ' ' . $camaextra . "\n";
    $mailbody .= "</table>";
    $mailbody .= "</body></html>";

    mail($to, $mailbody, $headers); 

    // If you want to receive the email using the address of the sender, comment the next $emailSent = ... line
    // and uncomment the one after it.
    // Keep in mind the following comment from the wp_mail() function source:
    /* If we don't have an email from the input headers default to wordpress@$sitename
    * Some hosts will block outgoing mail from this address if it doesn't exist but
    * there's no easy alternative. Defaulting to admin_email might appear to be another
    * option but some hosts may refuse to relay mail from an unknown domain. See
    * http://trac.wordpress.org/ticket/5007.
    */
    //$emailSent = wp_mail(ci_setting('booking_form_email'), get_option('blogname').' - '. __('Booking form', 'ci_theme'), $mailbody);
    $emailSent = wp_mail(ci_setting('booking_form_email'), get_option('blogname').' - '. __('Formulário de Reserva','theme-text-domain', 'ci_theme'), $mailbody, 'From: "'.$clientname.'" <'.$email.'>');
    $emailSent2 = wp_mail( $email, __('Booking Inquiry','theme-text-domain', 'ci_theme'), __('Thank you so much for your interest in Hotel Aveiro Center! We will get back to you within 24 hours to answer your request.','theme-text-domain','ci_theme'),'From: Hotel Aveiro Center <xxxx@xxxx>');

}
$headers='MIME版本:1.0'。“\r\n”;
$headers.='内容类型:文本/html;字符集=iso-8859-1'。“\r\n”;
//好的,我们已经发送电子邮件了!
if(空($errorString)){
$mailbody.='';
$mailbody.='';
$mailbody.='';
$mailbody.=\u('Nome:','ci\u theme')。$clientname.\n;
$mailbody.=\u('Email:','ci_theme')。$Email.\n;
$mailbody.=\u('Chegada:','ci_theme')。$arrival.\n;
$mailbody.=\u('Saída:','ci_theme')。$deep.\n;
$mailbody.=\u('Adultos:','ci\u theme')。$guests.\n;
$mailbody.=uu('Crianças:','ci_theme')。$children.\n;
$mailbody.=\u('Quarto:','ci\u theme')。$room->post\u title.\n;
$mailbody.=\u('Mensagem:','ci\u theme')。$message.\n;
$mailbody.=\uuuu('Hora do Check-in(hh:mm):','ci\u theme').'.$timeguest.“\n”;
$mailbody.=\u('Contacto:','ci\u theme')。$contactguest.\n;
$mailbody.=uuuo('Autorização:','ci_theme').'.$autorizo.\n”;
$mailbody.=\uuuuu('Cama Extra:','ci_theme')。$camaextra.\n;
$mailbody.=”;
$mailbody.=”;
邮件($to,$mailbody,$headers);
//如果要使用发件人的地址接收电子邮件,请在下一个$emailSent=…行中添加注释
//并取消其后面的注释。
//请记住来自wp_mail()函数源的以下注释:
/*如果输入标题中没有电子邮件,则默认为wordpress@$sitename
*如果此地址不存在,但不存在,某些主机将阻止来自此地址的传出邮件
*没有简单的选择。默认使用admin_电子邮件可能是另一种选择
*选项,但某些主机可能拒绝中继来自未知域的邮件。请参阅
* http://trac.wordpress.org/ticket/5007.
*/
//$emailSent=wp_邮件(ci_设置('booking_form_email')、get_选项('blogname').-'.\uu('booking form','ci_theme')、$mailbody);
$emailSent=wp_邮件(ci_设置('booking_form_email')、get_选项('blogname')。-'。。\uuu('Formulário de Reserva'、'theme-text-domain'、'ci_theme')、$mailbody,'From:“.$clientname.”);
$emailSent2=wp_mail($email、'seme-text-domain'、'theme-text-domain'、'ci_-theme')、'ci_(非常感谢您对酒店Aveiro Center的兴趣!我们将在24小时内回复您的请求。'、'theme-text-domain'、'ci_-theme')、'From:Hotel Aveiro Center');
}

这是我做的一个简单的例子

//build email to be sent
    $to = $email;
    $subject = $site_url;
    $subject .= ": Activate Your Account";

    $message = "
    <html>
    <head>
    <title>Account Activation</title>
    </head>
    <body>
    <h3>Account Activation</h3>
    <p>Dear ".$user.", thank you for registering at ".$site_url.".</p>
    <p>Please click on the link below to activate your account:</p>
    <a href='".$site_url."/confirm_user_reg.php?activation_key=".$activation_key."'>http://www.".$site_url."</a>.
    <p>If the above link does not work, copy and paste the below URL to your browser's address bar:</p>
    <p><i>http://www.".$site_url."/confirm_user_reg.php?activation_key=".$activation_key."</i></p><br/>
    <p>If you did not initiate this request, simply disregard this email, and we're sorry for bothering you.</p>
    <br/><br/>
    <p>Sincerely,</p>
    <p>The ".$site_url." Team.</p>
    </body>
    </html>
    ";

    // To send HTML mail, the Content-type header must be set
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
//生成要发送的电子邮件
$to=$email;
$subject=$site\u url;
$subject.=“:激活您的帐户”;
$message=”
帐户激活
帐户激活
亲爱的“$user.”,感谢您在“$site\u url”注册

请单击下面的链接激活您的帐户:

. 如果上述链接无效,请将以下URL复制并粘贴到浏览器的地址栏:

http://www.“$site\u url。”/confirm\u user\u reg.php?activation\u key=“.$activation\u key.”


如果您没有发起此请求,请忽略此电子邮件,我们很抱歉打扰您



真诚地

“$site\u url.”团队

"; //要发送HTML邮件,必须设置内容类型标题 $headers=“MIME版本:1.0\r\n”; $headers.=“内容类型:text/html;字符集=iso-8859-1\r\n”;
自定义邮件??您想拥有自己的
邮件正文
,但您正在这样做。您想在邮件中更改什么?首先,问题是什么?“我在挣扎”并没有给我们太多的工作机会。此外,您正在将值附加到
$mailbody
变量,但在此代码段中您尚未定义它。您需要先定义它(
$mailbody=NULL;
),然后才能附加。谢谢您的建议。我是php新手。我想(以后)做那件事