【发布时间】:2012-09-30 20:34:39
【问题描述】:
我正在尝试创建一个简单的 php 电子邮件表单,将提交的内容发送到指定地址,但我要解决的问题是发送电子邮件的地址 - 目前,它从 myusername@ 发送myhostingservice.com,但我希望能够将其更改为简单的 no-reply@mydomain.com 或其他内容。
<?php
$message = $_POST['message'];
$formcontent="$message";
$recipient = "reciever@example.com";
$subject = "question";
mail($recipient, $subject, $formcontent, $header, '-fno-reply@mydomain.com') or die("Error!");
header("Location: webpage_user_is_redirected_to.html");
?>
【问题讨论】:
-
不要使用 mail() 使用第三方库,如phpmailer