【问题标题】:I need senders email id in email subject我需要电子邮件主题中的发件人电子邮件 ID
【发布时间】:2014-11-28 09:03:50
【问题描述】:

我的 php 脚本运行良好,但我想在电子邮件主题中发送发件人地址。请指导我如何操作。

请告诉我应该在 "$emailSbuject = "New Subscription from $emailFeild\r\n";" 中写什么

这是我的 php 脚本:

<?php
/* subject and email varialbles*/

$emailSbuject = "New Subscription from $emailFeild\r\n";
$webMaster = 'help@sample.com';
$emailSbuject2 = 'Thank you';
$client = ' $emailFeild\r\n';
/*gathering data variables*/

$emailFeild = $_POST['email'];

// admin message body
$body= <<<EOD
New subscriber is $emailFeild

EOD;

$textMessage = <<<EOD

<p style="margin-left:5px;font-family:Calibri"><img alt=""         src="http://www.intaxfin.com/images/Intaxfin_logo.png"></p>

         <p style="font-family:Calibri">Thank you for subscribing with us. Somebody will get back     to you as soon as possible.</p>

<p  style="font-size:x-small;color:#0099FF;font-family:Calibri">This e-mail was automatically     sent by Administration Directory and is for your reference. Please do not reply to this e-    mail address.<br>
Powered by sample</p>

EOD;
    $headers = "From: $emailFeild\r\n";
    $header = "From: $noreply@sample.com\nMIME-Version: 1.0\nContent-Type: text/html;     charset=utf-8\n";
    $success = mail($webMaster,$emailSbuject,$body,$headers);
    $success1 = @mail($emailFeild,$emailSbuject2,$textMessage,$header);
    /*Result*/

    $theResults = <<<EOD
EOD;

echo  "$theResults";

header("Location: thankyousubscribe.html");
exit;
?> 

【问题讨论】:

  • 请先生帮帮我。 @Bowdzone
  • $emailSbuject = "New Subscription from ".$emailFeild."\r\n";
  • @Bowdzone thnx 先生。它的工作非常好。 :)

标签: php


【解决方案1】:
 $emailFeild = $_POST['email'];
 $emailSbuject2 = "New Subscription from $emailFeild";

注意:$client 已使用 $emailFeild 变量启动,该变量在该行之后启动。请先初始化变量,然后使用它。

【讨论】:

  • 我的答案被选中,现在我不知道为什么它被撤销了,我投了反对票...
  • 抱歉,您的代码不起作用。 @bowdzone 给出了正确答案。
猜你喜欢
  • 1970-01-01
  • 2018-04-29
  • 1970-01-01
  • 2016-03-10
  • 1970-01-01
  • 1970-01-01
  • 2017-02-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多