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!








Karen on April 27th, 2007
1
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.
Colleen on April 29th, 2007
2
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.
Neil on May 7th, 2007
3
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.
Gabe on May 11th, 2007
4
Tried it out on my site and it worked great! Thanks for the simple fix!
detrom on May 28th, 2007
5
It doesnt work on wp-email plugin! I have modified class-phpmailer.php but no worK, help please!
matt on July 9th, 2007
6
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!!
Owen on July 10th, 2007
7
@matt: One of the symptoms of Open Source I suppose. Multiple authors all with different coding and testing standards
apul on August 25th, 2007
8
this solution is not working in my case.
peterblaise on September 25th, 2007
9
> …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.
mike on April 7th, 2008
10
this solution worked like a charm - man i hate IIS
thank you!
Federico on April 8th, 2008
11
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-
foddski on May 15th, 2008
12
didn’t work for me either. moving to linux host
Mike Tee on May 20th, 2008
13
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
tushar on August 5th, 2008
14
Hello I tried ur mod. But it still not working. I use phpld 3.3, 3.2. No version is working
Federico on August 5th, 2008
15
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-
Apul on August 5th, 2008
16
I will do it for you. but I will charge for it. if you agree then send me a mail.
Andy Crathorne on August 16th, 2008
17
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.
James on September 18th, 2008
18
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