I'm getting the following error when using the Mail_smtp package from PEAR:

PHP has encountered an Access Violation at 0177A8B4

It does not occur everytime I use it, but even when send() returns true, e-mail messages are not being sent. However, it all worked fine a week ago when I was testing it, and I don't think anything has changed to my installation of PHP.

I'm using PHP 5RC1 on a Windows Server 2003. The localhost has no built-in mail functionality, so I cannot use mail(). I must use Mail_smtp to log in to the mail server. I also have Net_SMTP and Net_Socket installed, and, like I said, when I first dropped in my code, all was working fine.

My code is, as follows:

<code>
require_once 'Mail/smtp.php';

$smtp_settings = array(
    'host'     => 'localhost',
    'port'     => '25',
    'auth'     => 'LOGIN',
    'username' => 'username',
    'password' => 'password'
);

$to = "[EMAIL PROTECTED]";
$msg = "Line 1\nLine 2\nLine 3";
$headers = array(
    'Subject'      => "My Subject",
    'From'         => "[EMAIL PROTECTED]",
    'Date'         => date('r'),
    'Content-Type' => 'text/plain',
    'X-Mailer'     => "PHP/" . phpversion()
);

$mail = new Mail_smtp($smtp_settings);

if ($mail->send($to, $headers, $msg)) {
    echo "<h2>Sent successfully</h2>";
} else {
    echo "<h2>Not sent</h2>";
}
</code>

If I don't get the access violation error, I get the message "Sent successfully." Yet, I don't receive any messages.

In the code for Mail_smtp (in Mail/smtp.php), I have added the following line just under the function declaration line for the send() method:

echo "test";

When the access violation occurs, I get this line:

PHP has encountered an Access Violation at 0177A8B4test

From this, it appears to me that the access violation is not occurring when the class tries to send mail, but sometime earlier than that. However, I do not know much more about these Access Violoations, other than PHP is trying to access memory that it doesn't have permission to access. I couldn't find anything at bugs.php.net or through Google that helped much with this problem.

Any help would be greatly appreciated. I am on a tight deadline, so any help ASAP would be even more greatly appreciated. ;-)

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to