Can't send mail - bad response code
Posted: Thu Nov 30, 2006 12:44 pm
Hi,
I can't send email using e.g. following code:
I get error: Send Error: Sending to 1 recipients rejected (bad response code).
What should I do?
Debug (dump log) can be found at http://www.pcdelovi.com/dump.txt
I can't send email using e.g. following code:
Code: Select all
require('./Swift.php');
require('./Swift/Connection/SMTP.php');
function mailto($to,$subject,$body,$from) {
$mailer = new Swift(new Swift_Connection_SMTP('pcdelovi.com'));
$mailer->setCharset("UTF-8");
$mailer->addPart($body, "text/html");
//If anything goes wrong you can see what happened in the logs
if ($mailer->isConnected()) //Optional
{
//You can call authenticate() anywhere before calling send()
if ($mailer->authenticate('pcdelovi', 'mypassword'))
{
//Sends a simple email
$mailer->send(
$to,
$from,
$subject
);
echo "<pre>";
print_r ($mailer); //debug
echo "</pre>";
}
else return false;
//Closes cleanly... works without this but it's not as polite.
$mailer->close();
}
else return false;
return true;
}
$from = $_POST['email'];
$to = 'mymail@domain.com';
$subject = "Contact from website";
$body = $_POST['text'];
if ((!$from) or (!$body)) {
header("location: err.php"); die();
} else {
$sent = mailto($to,$subject,$body,$from);
if (!$sent) { header("location: mailnijeposlat.php"); die(); }
else { header("location: mailposlat.php"); die(); }
}What should I do?
Debug (dump log) can be found at http://www.pcdelovi.com/dump.txt