简体   繁体   English

如何从电子邮件“发件人”字段中删除服务器?

[英]How can I remove the Server from the email form “from” field?

I have a basic form created. 我创建了一个基本表单。

When the user fills and sends the form, in my client's email inbox it comes in FROM my server name. 当用户填写并发送表单时,在我客户的电子邮件收件箱中,它来自我的服务器名。

I have been looking through the code where I can edit this, but I am more designer than programmer. 我一直在寻找可以编辑此代码的代码,但是我比程序员更富有设计师。

What should I be looking for? 我应该找什么?

Thanks so much 非常感谢

you can only setup a name "displayed" to the receiver first. 您只能先为接收器设置一个“显示”的名称。 If the receiver looks into the message-header he will still see the origin (your server). 如果接收者查看邮件头,他仍将看到源(您的服务器)。

This is the usual snippet for this (see $headers) 这是通常的代码段(请参阅$ headers)

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

在您的PHP函数中,您需要在标题中设置“发件人”

mail("me@domain.com" "Subject", "Body", "From: sender@domain.com");
mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

In the aditional headers you can add the From header, for example: 在附加标题中,您可以添加From标题,例如:

mail("user@domain.com", "Test", "message", "From: user@domain.com BCC:friend@domain.com")

Also, you can change the Default From header in the php.ini if my memory doesn't fail. 另外,如果我的内存没有出现故障,则可以更改php.ini的Default From标头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果表单字段留空,如何从HTML电子邮件中删除表行 - How Can I Remove A Table Row From An HTML Email If Form Field Is Left Blank 如何以这种形式获取名称,电子邮件和主题,使其成为我从服务器收到的消息中的实际值? - How can I get the name, email and subject in this form become the actual values in the message I receive from the server? 如何从PHP表单发送带有附件的电子邮件? - How can I send an email with attachments from a PHP form? 我如何从 Html FORM 接收数据到我的电子邮件? - How i can receive data from Html FORM to my Email? 如何使用下拉菜单中的值填充隐藏的表单字段? - How can I poupulate a hidden form field with a value from a dropdown? 如何将字符串附加到表单字段中的数据 - How can I append a string to the data from a form field 当我在“发件人”字段中收到两次表格回复时,列出了两次电子邮件? - When I receive form response in the from field to lists email twice? 如何从包创建自定义航海者表单字段? - How can I create a custom voyager Form Field from package? PHPmailer如何删除所需的“发件人”作为无效电子邮件 - PHPmailer how to remove required “From field” as an vaild email 我如何从PHP表单发送电子邮件 - How do i email from php form
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM