hey, i think the reason you get no reply is becauase no one knows why it happens





From: Ben Ramsey <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP Access Violation using PEAR::Mail_smtp
Date: Tue, 06 Apr 2004 14:27:08 -0400

I've asked about PHP Access Violation errors before (this very same error, as a matter of fact), and every time I ask, I get no response. It's been 24 hours, and no one on php-general, pear-general, or #php and #pear in Freenode IRC has responded to this particular post.

Do I smell bad?

Please forgive me for refreshing my own post to the list, but this is an important question, and it is time-sensitive. Any help or pointers would be greatly appreciated, as I cannot get around this issue at all.

Thanks,
Ben


Ben Ramsey wrote:


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


_________________________________________________________________
Tax headache? MSN Money provides relief with tax tips, tools, IRS forms and more! http://moneycentral.msn.com/tax/workshop/welcome.asp


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



Reply via email to