PHPmailer Stopped Working on Jodohost

PHPMailer uses a mix of object properties and methods for setting required values. So, while you can do $mail->From = '[email protected]' you can't do that with the To addresses. It's a bit confusing.

Maybe this will help? Here's a simplified version of a function I use to send mail. I set various values in a config file (such as the mail server, whether to use SMTP auth, and so forth). My config file also loads the phpmailer class.

Code:
function sendEmail($to, $subject, $message) {
	global $config;
	// email address is good, process message
	$mail = new PHPMailer();
	$mail->IsSMTP(); // telling the class to use SMTP
	$mail->SMTPAuth = $config['SMTP_AUTH']; // telling the class to use SMTP Auth
	$mail->Username = $config['SMTP_USER'];
	$mail->Password = $config['SMTP_USER_PASSWORD'];
	$mail->Host = $config['SMTP_SERVER'];
	
	$mail->From = $config['FROM_ADDRESS']; // '[email protected]'
	$mail->FromName = $config['FROM_NAME']; // 'Sally Sample'
	
	if(strpos($to, ',')!==FALSE) {
		// If passed a comma-separated list of email addresses
		// turn the list into an array and add them to the TO line
		$toArray = explode(',',$to);
		$cnt=count($toArray);
		for($i=0;$i<$cnt;$i++) {
			// add an array of email addresses to the TO line
			$mail->AddAddress($toArray[$i]);
		} // end for()
	} else {
		// passed a single address, add it as the to list
		$mail->AddAddress($to);
	} // end if(strpos...
	
	$mail->Subject = $subject;
	$mail->Body = $message;
	$mail->WordWrap = 70;
	
	if(!$mail->Send()) {
		return $mail->ErrorInfo;
	}
}

You can add an array to the TO line or a single address. The function supports that. You could add these to the CC or BCC lines instead if you wanted.

@zardiw - on one of my client sites, they have close to a thousand addresses on their list. My code loops through batches of 50 at a time, creating an individual email for each recipient putting them on the To line. I pause a few seconds between each batch. This is basically what newsletter systems like phpList do.

Make sure you've sent in the JodoHost bulk mailing form to the legal department so you don't have all mail blocked on your domain.

Tim
 
Thanks Tim....no I haven't sent in a form yet.....you got a link, or should I submit a TT?.......z
 
I am having a major issue as well, but not phpmailer, rather swiftmailer. Sure the brand new version works fine. It is the old code that I need to know what was changed that caused anywhere from 70-200 of my websites to stop working.

SO!!!

Did anyone figure out what happened. All my forms failed to authenticate. EVEN THOUGH I authenticate.
 
You might want to check your control panel web options. You might have changes that need to be applied, since the HSphere upgrade........z
 
You might want to check your control panel web options. You might have changes that need to be applied, since the HSphere upgrade........z

Ah YES, great idea. I checked and yes changes needed to be applied but no the problem was not fixed.
 
What I got back "due to spamming from web server, our web server ip got blocked on rbl that is being used by mail server. That's why you had this issue."

My problem was fixed by declaring port 587 instead of 25.
 
Looks like PHP Mailer is broken again.......Tried port 587 .....still doesn't work. I've made NO changes to this in a LONG time.......z
 
The message was 'could not connect to smtp server' ....but it seems to be working now.......but the Joomla create account doesn't (started a new thread for that btw).........z
 
Back
Top