2016-04-25 12 views
0

Ich habe ein Projekt, in dem ich 100-200 Mails an Benutzer senden muss, aber jede Mail hat unterschiedliche Token für jeden Benutzer. Ich habe die E-Mail auf godaddy gehostet.Php Mailer Fehler - Godaddy Smtp

Also ich wollte E-Mail mit phpmailer senden. Unten ist das Skript, das ich teste, aber es gibt mir diesen Fehler -

SMTP-Fehler: Verbindung zum Server konnte nicht hergestellt werden: Verbindung abgelehnt (111) SMTP connect() fehlgeschlagen. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Mailer Fehler: SMTP connect() fehlgeschlagen. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

<?php 

//SMTP needs accurate times, and the PHP time zone MUST be set 
//This should be done in your php.ini, but this is how to do it if you don't have access to that 
date_default_timezone_set('Etc/UTC'); 

require 'mailm/PHPMailerAutoload.php'; 

//Create a new PHPMailer instance 
$mail = new PHPMailer(); 
//Tell PHPMailer to use SMTP 
$mail->isSMTP(); 
//Enable SMTP debugging 
// 0 = off (for production use) 
// 1 = client messages 
// 2 = client and server messages 
$mail->SMTPDebug = 2; 
$mail->DKIM_domain = '127.0.0.1'; 
//Ask for HTML-friendly debug output 
$mail->Debugoutput = 'html'; 
//Set the hostname of the mail server 
$mail->Host  = "smtpout.secureserver.net"; 
//Set the SMTP port number - likely to be 25, 465 or 587 
$mail->Port  = 465; 
//Whether to use SMTP authentication 
$mail->SMTPAuth = true; 
//Username to use for SMTP authentication 
$mail->Username = "[email protected]"; 
//Password to use for SMTP authentication 
$mail->Password = "Mypassword"; 
$mail->SMTPSecure = 'ssl'; 
//Set who the message is to be sent from 
$mail->setFrom('[email protected]', 'IT Helpdesk'); 
//Set an alternative reply-to address 
//$mail->addReplyTo('[email protected]', 'First Last'); 
//Set who the message is to be sent to 
$mail->addAddress('[email protected]', 'IT Helpdesk'); 
//Set the subject line 
$mail->Subject = 'PHPMailer SMTP test'; 
//Read an HTML message body from an external file, convert referenced images to embedded, 
//convert HTML into a basic plain-text alternative body 
//Replace the plain text body with one created manually 
$mail->Body = 'This is a plain-text message body'; 
//Attach an image file 


//send the message, check for errors 
if (!$mail->send()) { 
    echo "Mailer Error: " . $mail->ErrorInfo; 
} else { 
    echo "Message sent!"; 
} 
?> 

Dieses Skript, das ich auf einem Blog gefunden zu haben.

Alle Alternativen dazu sind ebenfalls willkommen, Mein Zweck ist es, 200 E-Mails von meinem godaddy E-Mail-Konto zu senden, aber jede E-Mail hat ein separates Token, das aus der Datenbank geholt und dann in den Nachrichtentext eingefügt und an den Benutzer gesendet wird.

+0

aber es klingt für mich das Problem ist nicht im Zusammenhang mit dem spezifischen Code, aber es bezieht sich auf die "SMTP-Autorisierung". Wie haben Sie sichergestellt, dass die SMTP-Verbindung hergestellt und der Mail-Server ordnungsgemäß eingerichtet wurde? – Farside

+0

Abgesehen von der GoDaddy-Auth-Ausgabe, basieren Sie Ihren Code auf [das Beispiel der Mailingliste, das mit PHPMailer bereitgestellt wird] (https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps). – Synchro

Antwort

0

, das so einfach ist:

Sie auf SMTP-Host konzentrieren muss, Port, ssl ... ändern SMTP-Host: relay-hosting.secureserver.net und DELETE-Port und ssl, das ist alles .. . sMTP-Port und smtp ssl wahr oder falsch ...

var fromAddress = "[email protected]"; 
    // any address where the email will be sending 
    var toAddress = "[email protected]"; 
    //Password of your mail address 
    const string fromPassword = "******"; 
    // Passing the values and make a email formate to display 
    string subject = TextBox1.Text.ToString(); 
    string body = "From: " + TextBox2.Text + "\n"; 
    body += "Email: " + TextBox3.Text + "\n"; 
    body += "Subject: " + TextBox4.Text + "\n"; 
    body += "Message: \n" + TextBox5.Text + "\n"; 
    // smtp settings 
    var smtp = new System.Net.Mail.SmtpClient(); 
    { 
     smtp.Host = "relay-hosting.secureserver.net"; 
**//Warning Delete =>//smtp.Port = 80;** 
**//Warning Delete =>//smtp.EnableSsl = false;** 
     smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; 
     smtp.Credentials = new NetworkCredential(fromAddress, fromPassword); 
     smtp.Timeout = 20000; 
    } 
    // Passing values to smtp object 
    smtp.Send(fromAddress, toAddress, subject, body); 
0

Sie ändern müssen einige Konfigurationen nicht unten erwähnt verwenden. lassen Sie mich wissen, ob das funktioniert oder nicht.

$mail->Host = 'localhost'; 
$mail->Port = 25; 
$mail->ssl = false; 
$mail->authentication = false; 
Verwandte Themen