Can't access phpMailer class

Since it seems that I'm forced to change code that was working, (customer is very upset!) I need to find a working source example of how to use phpMailer on a Windows account. I found some code on this board, but it fails to run complaining: Warning: main(class.phpmailer.php): failed to open stream: No such file or directory in D:\hshome\zooraft\zooraft.com\test\phpMailer.php

If anyone knows how to send email using php on a Jodo Windows account, I'd appreciate the answer very much!
Thanks...
 
We are not forcing anyone to change any code, you can use php mail() just some destination servers may not get the mail.
 
Now, I'm really confused. I was informed by Reseller Support that I must use this class. They said it was the solution to the problem I had where the mail() function was failing to send email. This code worked at one time. I generated a test message which was successfully mailed to the client. Then the client called, complaining that he was missing emails.
I am now sending a test message to my admin account. This message fails to be received.
Can mail() send email to it's own domain? Is this blocked by the new anti-spam policy? Help!
 
mai() can be blocked for many reasons, but mostly because it doesn't have rDNS, mail() uses the localhost mail server where the phpmailer class uses smtp auth. You will need to specific the class path for phpmailer to work.
 
I would love to. What is the class path? I have been trying to find out this information for quite a while!

But, I would rather know if mail() sends a message that will be refused by the domain it originated from.
This script sends an email to the site owner when a customer fills out a form. I would think that the simple mail() function would work. Are jodo domains refusing messages sent by the mail() function?
Can this be fixed?

Thanks,
Shannon Vance
 
Will need to see from tanmaya if non rDNSed mail is refused now, he will be on shift in 8 hours or so.
 
Oh, I see. Having looked further at the source forge site. I now see that I must download their software, then copy the classes to the web site. Now that I've done that, the class is being loaded. I still can't get it to send a message yet.
I modified the code I found in the readme file from sourceforge.


<?
require("../library/class.phpmailer.php");
require("../library/class.smtp.php");
$mail = new PHPMailer();

$mail->IsSMTP(); // send via SMTP
$mail->Host = "localhost"; // SMTP servers
// $mail->Host = "mail.mydomain.com"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "xxxx"; // SMTP username
$mail->Password = "yyyy"; // SMTP password

$mail->From = "[email protected]";
$mail->FromName = "Tester";
$mail->AddAddress("[email protected]","Shannon Vance");
$mail->AddAddress("[email protected]","Shannon Vance");
$mail->AddReplyTo("[email protected]","Information");

$mail->WordWrap = 50; // set word wrap
// $mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
// $mail->AddAttachment("/tmp/image.jpg", "new.jpg");
$mail->IsHTML(true); // send as HTML

$mail->Subject = "Here is the subject";
$mail->Body = "This is the <b>HTML body</b>";
$mail->AltBody = "This is the text-only body";

if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}

echo "Message has been sent";

?>
 
Here's some code that works for me:
Code:
require("class.phpmailer.php"); // would load from current directory
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // telling the class to use SMTP Auth
$mail->Username = '[email protected]';
$mail->Password = 'password';
$mail->Host = 'mail.yourdomain.com'; // SMTP server

$mail->From = '[email protected]';
$mail->FromName = 'Full Name';
$mail->AddAddress('[email protected]');
$mail->AddReplyTo('[email protected]');

$mail->Subject = 'The message subject';
$mail->Body = 'This is the message body';
$mail->WordWrap = 70;

if(!$mail->Send()) {
	echo "Message was not sent";
	echo "Mailer Error: " . $mail->ErrorInfo;
} else {
	header('Location:followup.php');
	die();
}

I don't really see any significant differences between your code and mine.

Are you getting any error messages? Will it send to an address at a site hosted here at JodoHost but not elsewhere? Are you using a real email address and correct password for the $mail->Username and password? Try setting the $mail->Host to be your mail server rather than localhost.

Also, I had a few clients complaining to me over the past few days that script-based mail was not sending from their sites. I even opened a ticket about it. I guess outgoing mail was just slow. When I tested yesterday, messages sent in the morning arrived in the evening (at off-site addresses, those to jodo-hosted email addresses showed up instantly). So perhaps there's just a timing thing going on. Also, check spam filters at the receiving addresses to make sure messages aren't being blocked.

Tim
 
Well, I gave up last night. Nothing worked... but this morning I wake up to a whole bunch of test messages! The emails to outside domains took just as long as the ones to my jodohost account. So internal emails (although the servers were different) took long also. I switched to using an asp solution based on CDONTS. It worked instantly, like I needed. But, I will try some more to use phpMailer. Thanks for the code and help!
 
Generally, mail sending via PHP should be as quick as sending by ASP/CDONTS. However, your CDONTS code is probably using the localhost server for SMTP. Your localhost server (whichever web server you're running on) might be less loaded than whichever mail server the PHP code is using. Also, the mail server could be configured differently in such a way as to cause the delay.

Like you, I'm not satisfied with the enormously long time that it's taking for PHP-based mail to go out. I hope Jodo can address this issue quickly, as it puts me in the hotseat with my customers who expect a lot from me.

Tim
 
My latest test indicates that it fails when using mail domain as suggested for the Host. I would expect this to work.
But, it failed with the string: Language string failed to loadrecipients_failedthen the email addresses I used as test recipients

I am definately using the correct string for the Host.

Any ideas why this failed? Or should I just use localhost and not care?
 
The code is basically the same as posted above. I don't think it's a coding error. I think it is in the mail server config.
I think I need someone from jodohost to look at this.
 
Yes there is a ticket. This whole thing came into play because my customer was not getting emails from his website.
Here is the ticket number: [RS #PQR-24583-235]: Mail fails from zooraft.com

It would be great if the php mail() function would work here because I have had to switch to an asp solution and would rather use the original design
Thanks,
Shannon Vance
 
Back
Top