batchSend() not working on my new webhost

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
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

batchSend() not working on my new webhost

Post by Josh1billion »

I've never had any problems with Swift Mailer until using my new webhost, now I have this problem: messages aren't being sent out.

I'm using batchSend() to send a message to all of my members. I have a bunch of setup code (to build $message, $recipients, etc.), and then these two lines of code after that:

Code: Select all

 
    $number_sent = $swift->batchSend($message, $recipients, new Swift_Address("noreply@seedsoftime.net", "Seeds of Time Online"));
    
    print "Message sent to <b>$number_sent recipients</b>.";
The message my page displays is "Message sent to 0 recipients." Odd since it was working with my previous hosts. The only thing I changed in the code was the message's text (which, of course, wouldn't affect anything).

Is there some option my host has disabled for e-mail-related activity? Btw, I'm using PHP 5 (5.2 I believe, same version as on my last host).
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: batchSend() not working on my new webhost

Post by Chris Corbyn »

What does this show?

Code: Select all

<?php
 
require_once 'lib/Swift.php';
require_once 'lib/Swift/Connection/SMTP.php';
 
$log = Swift_LogContainer::getLog();
$log->setLogLevel(4);
 
// .. Add your existing code here
 
echo '<pre>', htmlentities($log->dump(true)), '</pre>';
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

Re: batchSend() not working on my new webhost

Post by Josh1billion »

EDIT: Nevermind, I figured it out thanks to the log. :)

Here's what the problem was: I was sending from noreply@seedsoftime.net, but I didn't have that "noreply@seedsoftime.net" e-mail address actually created in cPanel. For some reason, this host won't send an e-mail unless the "from" address actually exists, while the other hosts didn't complain.

Thanks for your help, Chris!
Post Reply