[英]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.