2017-09-04 41 views
-1

我已经配置了postfix和我目前在ubuntu,nginx中托管我的网站,我也安装了sendmail以及 因为我完全是新的这个我很高兴约wheather我安装任何其他服务和改变你的任何configurations.thank提前后缀是发送邮件到var /邮件/用户,而不是gmail

<?php 

    if(isset($_POST['submit'])) { 
     $name = $_POST['username']; 
     $email = $_POST['email']; 
     $number = $_POST['phone']; 
     $profession = $_POST['profession']; 

     $to = '[email protected]'; 
     $subject = 'user registration'; 
     $phone = "phone number:".$number; 
     $message = "client details:"."\n"."Name:".$name."\n"."email:".$email."\n"."phone number:".$number."\n"."profession:".$profession; 
     $headers = "From:".$email; 

    if(mail($to, $subject, $message, $headers)) { 
     header("Location: ../../thankyouNew.html"); 
    } else { 
     header("Location: ../../somethingWrong.html"); 
    } 
} 

?> 
+1

[PHP的邮件功能不完整的电子邮件发送(可能的重复https://stackoverflow.com/questions/24644436/php-mail-function-不发送完整的电子邮件) – Qirel

+0

我建议你找出为什么你的PHPMailer不能工作。使用该库比使用内置的mail()函数更好。如果您现在使用的代码,它很容易受到头注入。 – Qirel

回答

0

即使你可以完成使用发送邮件()函数的电子邮件的详细信息,我不会把它推荐给你。你会有一些其他的问题,如垃圾邮件....

所以相反,我会选择一个SMTP库,如PHPMailer。

这里是他们的文档: https://github.com/PHPMailer/PHPMailer

+0

我也试过这个, – vihar

相关问题