Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
646 views
in Technique[技术] by (71.8m points)

phpmailer - setFrom alternative goDaddy

I understand that gmail, yahoo, hotmail etc. etc. won't work with goDaddy and PHPMailer but what email address should I use for setFrom? I would appreciate any help in figuring this out! (I'm trying to have the name and email entered on an html contact form be emailed to me)

<?php
  use PHPMailerPHPMailerPHPMailer;
  use PHPMailerPHPMailerSMTP;
  use PHPMailerPHPMailerException;

  require 'Exception.php';
  require 'PHPMailer.php';
  require 'SMTP.php';

  $mail = new PHPMailer();

  $mail->isSMTP();
  
  $mail->SMTPDebug = SMTP::DEBUG_SERVER;
  
  $mail->Host = 'localhost';
  $mail->SMTPAuth = false;
  $mail->SMTPAutoTLS = false; 
  $mail->Port = 25;

  //Set who the message is to be sent from
  $mail->setFrom('MY_UNUSABLE_EMAIL', 'MY_NAME');

  //Set an alternative reply-to address
  $mail->addReplyTo($_POST['email'], $_POST['name']);

  //Set who the message is to be sent to
  $mail->addAddress('MY_UNUSABLE_EMAIL', 'MY_NAME');
  
  // Content
  $mail->Body = <<<EOT
  You've recieved a new submission from: {$_POST['name']}.
  Their email is: {$_POST['email']}.
EOT;

  $mail->Send();
?>
question from:https://stackoverflow.com/questions/65868203/setfrom-alternative-godaddy

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...