Code Search for Developers
 
 
  

rotating_connections.php from Astrum Futura at Krugle


Show rotating_connections.php syntax highlighted

<?php

require('Swift.php');
require('Swift/Connection/SMTP.php');
require('Swift/Connection/Rotator.php');
require('Swift/Plugin/ConnectionRotator.php');

//The mailer will now establish a connection with the server
$mailer = new Swift(
	//Add as many connections as you want.  They can be any combination of types
	new Swift_Connection_Rotator(array(
		new Swift_Connection_SMTP('smtp.domain1.co.uk'),
		new Swift_Connection_SMTP('smtp.domain2.tld'),
		new Swift_Connection_SMTP('mail.domain3.com')
	))
);

//We need this plugin loaded for the connections to rotate
$mailer->loadPlugin(new Swift_Plugin_ConnectionRotator);

$list = array(
	'"Chris" <chris@host1.tld>',
	'"Chris" <chris@host2.tld>'
);

//If anything goes wrong you can see what happened in the logs
if ($mailer->isConnected()) //Optional
{
	//Sends a simple email
	$mailer->send(
		$list,
		'"Your name" <you@yourdomain.com>',
		'Rotator connection',
		"Connection rotating!!!"
	);
	//Closes cleanly... works without this but it's not as polite.
	$mailer->close();
}


?>



See more files for this project here

Astrum Futura

Multiplayer space strategy game written in PHP5 with the Zend Framework. User interface uses Javascript/AJAX for dynamic interaction. Players compete across a hexagonal map of 10,000 sectors, planets, stars and other locations through trade and combat.

Project homepage: http://sourceforge.net/projects/astrumfutura
Programming language(s): PHP,XML
License: other

  attachment_smtp.php
  basic_sendmail.php
  basic_smtp.php
  basic_smtp_multipart.php
  batch_smtp_multipart.php
  cc_smtp.php
  embedded_image.php
  loading_plugin.php
  native_mail.php
  rotating_connections.php
  smtp_authentication.php
  smtp_ssl.php
  smtp_tls_gmail.php