Sunucumda(yerel değil) bir iletişim formundan gelen bilgileri kendi mail adresime göndermem gerek ancak bir şekilde sunucu bunu gerçekleştiremiyor ve şu hatayı veriyor: Message could not be sent.Mailer Error: The following From address failed: info@myserver.com : Called Mail() without being connected
Kodlar şunlar:
$mail = new PHPMailer; $mail->IsSMTP(); // Set mailer to use SMTP $mail->Host = 'localhost'; // Specify main and backup server $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'info@myserver.com'; // SMTP username $mail->Password = 'mypassword'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted $mail->From = 'info@myserver.com'; $mail->FromName = 'John Smith'; // Add a recipient $mail->AddAddress('myemail@gmail.com'); // Name is optional // $mail->AddReplyTo('info@example.com', 'Information'); $mail->WordWrap = 70; // Set word wrap to 50 characters $mail->IsHTML(true); // Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if(!$mail->Send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; }