I’ve just spent some time figuring our an issue I’ve had with PHPLinkDirectory running on IIS. I’m building a new directory site for SearchMann and decided to use an off-the-shelf package for doing this. The biggest problem I’m finding is that the majority of phpLD’s user base run the package on Apache where PHP runs better than on IIS. It’s not the language itself that’s the problem, more the capabilities of the platform. My biggest bug bear so far is the fact that there’s no equivalent of mod_rewrite on IIS, but that’s another story …
Anyway, the problem started when I tried sending email and started getting the following cryptic message:
Language string failed to load: instantiate
I spent some time trying to figure out why it wasn’t picking up the correct language file but then decided I should really be looking at the source of the problem. What was the error message it was trying to report?
Turns out the problem lay in the actual mail component not managing to send out email and trying to report an initialisation problem. I turned my attention to this and spent a substantial amount of time trying to figure out why.
Eventually the penny dropped! I had already come across this problem in the past while sending email from PHP. This is caused by the way the windows mail server interprets the headers being sent to it. The solution was simple (once you figure it out), and involves removing the “<” section that adds the sender name so that your mail program can describe the email address is receives.
So I found this code:
/**
* Formats an address correctly.
* @access private
* @return string
*/
function AddrFormat($addr) {
if(empty($addr[1]))
$formatted = $addr[0];
else
{
$formatted = $this->EncodeHeader($addr[1], ‘phrase’) . ” <” .
$addr[0] . “>”;
}return $formatted;
}
and replaced it with:
/**
* Formats an address correctly.
* @access private
* @return string
*/
function AddrFormat($addr) {$formatted = $addr[0];
return $formatted;
}
and voila’. Problem solved!
Just a quite note that this solution effectively changes the mail header to omit the senders name. I suspect this is due to my hosting provider’s configuration, but I’m led to believe it’s not an uncommon problem on Windows servers running php. If you run into a similar problem, I hope this post has been useful.
Best of luck!
I had to let you know that I (my xanga blog) finally got listed in DMoz!! I guess you have to pester them a lot.
All greek to me 🙂
I only have one issue with PHP and emails. It sends out all of my emails fine, except the ones I am trying to send to notify of payment being received. Those always bounce back to me.
Hi, just to let you know, I’ve tried your solution in wp-email and it did not worked for me 🙁
I’ve modified the class-phpmailer.php according to your solution, but no luck.
Tried it out on my site and it worked great! Thanks for the simple fix!
It doesnt work on wp-email plugin! I have modified class-phpmailer.php but no worK, help please!
wordpress users: the wp-email author didn’t include the languages directory in his/her hack. you’ll need to download the entire php-mailer package and extract the languages directory then use the SetLanguage function to point to the correct directory.
FUN!!
@matt: One of the symptoms of Open Source I suppose. Multiple authors all with different coding and testing standards
this solution is not working in my case.
> …author didn?t include the languages
> directory in his/her hack. you?ll need
> to download the entire PHP-mailer
> package and extract the languages
> directory then use the SetLanguage
> function to point to the correct directory.
… “use the SetLanguage” by doing what? Thanks.
this solution worked like a charm – man i hate IIS
thank you!
Hi !
I’m using PHPMailer without problems until this error appears…
I don’t know why appear… The other webpages that i have are uploaded and working fine…
This ‘solution’ is not working for me neither…
Can you help me please ?
-ByE-
didn’t work for me either. moving to linux host
Stumbled upon the same error message on a similar installation on IIS – but it turned out that the problem wasn’t caused by IIS at all.
Our local ISP had changed its SMTP port from 25 to 587 – the program worked fine when we dealt with it by adding a $mail->Host = 587 in the script
Hello I tried ur mod. But it still not working. I use phpld 3.3, 3.2. No version is working
Hello,
I’ve used the next instruction:
$mail->isSmtp(false/true);
(I don’t remember exactly how it was)
That’s working for me…
Try to use it.
-ByE-
I will do it for you. but I will charge for it. if you agree then send me a mail.
Brilliant! This works a treat. I had come across this a long time ago and couldn’t remember how I overcame it but this works perfectly.
Just have to remember to change this back should we move over to our Linux server!
Thanks for the post.
Thank you for posting this. It was a big help in fixing the error I was having with a new site installation (transfer) and getting my clients newsletter out to their 600 members.
Very much appreciated!
James
Works an absolute treat – this is the first time I have ever encountered a problem and found a solution straight away.
Thanks a lot.
Thanks man, great help!
Thanks, worked for me! 🙂
Please i need mailer to send mails kindly help me out with it .
thank you for this simple fix, you just made my day. lol