Sending mail fails

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
Dries
Forum Newbie
Posts: 2
Joined: Sat Dec 06, 2008 8:30 am

Sending mail fails

Post by Dries »

What is wrong in this script?

Code: Select all

<?php
 
session_start();
 
require_once('login.php');
include("./system/config.php");
echo "<h2>Mailings versturen</h2><br />";
 
$sql = "SELECT * FROM mail_templates WHERE id=2";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
 
$bericht = $row['bericht'];
 
//Load in the files we'll need
require_once "./mail/Swift.php";
require_once "./mail/Swift/Connection/SMTP.php";
 
$smtp =& new Swift_Connection_SMTP("mail.d-devs.be", 25);
$smtp->setUsername("*********");
$smtp->setpassword("***********");
 
$swift =& new Swift($smtp);
 
$recipients =& new Swift_RecipientList();
 
$sql2 = "SELECT * FROM nieuwsbrief_leden";
$result2 = mysql_query($sql2) or die(mysql_error());
 
 while($row2 = mysql_fetch_array($result2))
 {
    $recipients->addTo($row2['naam'], $row2['email']);
 };
 
 
 
//Create the message
$message =& new Swift_Message("Some subject", $bericht, "text/html");
 
//Now check if Swift actually sends it
if ($swift->send($message, $recipients, "steenhouwer.dries@gmail.com")) echo "Sent";
else echo "Failed";
?>
I tried a lot but nothing happens
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Sending mail fails

Post by Chris Corbyn »

Do you get any output at all? Have you got error reporting turned on if not?
Dries
Forum Newbie
Posts: 2
Joined: Sat Dec 06, 2008 8:30 am

Re: Sending mail fails

Post by Dries »

No, he just return failed...

An also my php error handling is on an the handler says nothing...
Post Reply