note 77212 deleted from ref.mail by nlopess
| From: | nlopess@php.net | Date: | Sat, 01 Sep 2007 12:01:55 +0000 |
| Subject: | note 77212 deleted from ref.mail by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130004@lists.php.net to get a copy of this message | ||
Note Submitter: contact at xpertmailer dot com
----
SMTP servers are configured to block mails for a period afther a certain number of received mails
(based on IP address), to protect from spammers. Now, you can avoid this problem by connecting to
internet with another IP afther a number of sent mails. To do this, you must create context
connection:
<?php
// path to 'MAIL.php' file from XPM4 package
require_once '/path/MAIL.php';
$m = new MAIL; // initialize MAIL class
// set option "bindto" IP_ADDRESS:PORT
// more info: http://www.php.net/stream_context_create
$o = array('socket' => array('bindto' => '192.168.0.100:0'));
$m->Context($o); // set context connection
$m->From('me@myaddress.net', 'My Name');
$m->AddTo('client@destination.net', 'Client Name');
$m->Subject('Hello World!');
$m->Text('Text version of message.');
// send mail directly to client SMTP server
echo $m->Send('client') ? 'Mail sent !' : 'Error !';
print_r($m->History); // print History for debugging
?>
To use an IP address other than default, you must have configured properly your IP addresses list.
For more options and informations visit http://www.xpertmailer.com .