# PHPMailer error

**URL:** <https://forum.kirupa.com/t/phpmailer-error/262919>\
**Category:** Uncategorized\
**Created:** [June 11, 2008, 4:05am UTC](https://forum.kirupa.com/t/phpmailer-error/262919 "2008-06-11T04:05:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![monkeyface](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@monkeyface](https://forum.kirupa.com/u/monkeyface)\
**Post date:** [June 11, 2008, 4:05am UTC](https://forum.kirupa.com/t/phpmailer-error/262919/1 "2008-06-11T04:05:46Z")

</div>

Hi!  
I’ve installed PHP mailer, and im having a bit of a problem. Ive placed all the necessery files that i need into a directory, along w/ my php file with the following code:  
\*\*Btw,\*\*im aware that the email addys arent the correct ones…

```php

 <?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.central.cox.net"; // SMTP server
$mail->From = "MYEMAIL@gmail.com";
$mail->AddAddress("MYEMAIL@yahoo.com");

$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! 

 This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;

if(!$mail->Send())
{
   echo 'Message was not sent.';
   echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
   echo 'Message has been sent.';
}
?>

```

**Error messege:**  
Message was not sent.Mailer error: Language string failed to load: connect\_host

**The PHP Lanugage english file, says that “connect\_host” means that “SMTP Error: Could not connect to SMTP host.’;”, BUT, I JUST set up my outlook express using the same smtp server, and it works perfectly.**

Any suggestions/links/help?:crying:

I appreciate it, thanks.

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 11, 2008, 1:09pm UTC](https://forum.kirupa.com/t/phpmailer-error/262919/2 "2008-06-11T13:09:40Z")

</div>

don’t use the smtp declaration

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 11, 2008, 1:18pm UTC](https://forum.kirupa.com/t/phpmailer-error/262919/3 "2008-06-11T13:18:26Z")

</div>

[QUOTE=ahmednuaman;2340678]Why not?[/QUOTE]  
if he’s having issues w/ it then the quickest and easiest way to “solve” it would be to not use it. there was no other reason than that, don’t look to much into it.

---

<div class="post-metadata">

**Author:** ![monkeyface](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@monkeyface](https://forum.kirupa.com/u/monkeyface)\
**Post date:** [June 11, 2008, 1:31pm UTC](https://forum.kirupa.com/t/phpmailer-error/262919/4 "2008-06-11T13:31:27Z")

</div>

ahmednuaman, those SMTP settings are from my ISP. Im using this free server space to test the pages out, and I’m not sure how to check for their SMTP.

simplistik, the only reason why I used it is b/c the PHP Mailer site instructed me to…I’m pretty much a PHP noob…

Well if I remove SMTP from the code, how will it send the e-mail messege? I know that Ive used a form code b/4 without a SMTP address, but I’m not sure why they had this if it wasnt needed.

What should i do? :crying:

---

<div class="post-metadata">

**Author:** ![monkeyface](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@monkeyface](https://forum.kirupa.com/u/monkeyface)\
**Post date:** [June 11, 2008, 2:29pm UTC](https://forum.kirupa.com/t/phpmailer-error/262919/5 "2008-06-11T14:29:08Z")

</div>

ahmednuaman: I see, thanks for that explanation!

For some reason now that I removed the SMTP stuff from the code, it sends, which makes me wonder why it was needed in the first place??

At least I got it to work.

---

<div class="post-metadata">

**Author:** ![monkeyface](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@monkeyface](https://forum.kirupa.com/u/monkeyface)\
**Post date:** [June 11, 2008, 2:37pm UTC](https://forum.kirupa.com/t/phpmailer-error/262919/6 "2008-06-11T14:37:08Z")

</div>

I see, I guess that explains it all.  
I might use my gmail to do that, to learn a little bit more.

Thanks again.

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 11, 2008, 5:08pm UTC](https://forum.kirupa.com/t/phpmailer-error/262919/7 "2008-06-11T17:08:45Z")

</div>

[QUOTE=monkeyface;2340688]simplistik, the only reason why I used it is b/c the PHP Mailer site instructed me to…I’m pretty much a PHP noob…

Well if I remove SMTP from the code, how will it send the e-mail messege? I know that Ive used a form code b/4 without a SMTP address, but I’m not sure why they had this if it wasnt needed.[/QUOTE]

I use phpmailer too and the smtp and pop options are optional. but like ahmednuaman says you do have greater control over what your headers are sending from. but also, if you’re not spamming people or don’t use keywords in your headers and body in the first place your mail will most likely not be caught by a spam blocker. so about 99% of the time there’s really no need to use it for the sake of spam protection. the biggest advantage of it would be emailing from your site, and it looking like it legitimately came from say your gmail account, instead of a private server.

---

<div class="post-metadata">

**Author:** ![monkeyface](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@monkeyface](https://forum.kirupa.com/u/monkeyface)\
**Post date:** [June 11, 2008, 5:10pm UTC](https://forum.kirupa.com/t/phpmailer-error/262919/8 "2008-06-11T17:10:38Z")

</div>

^That makes perfect sense…

Thanks a lot again for all your explanations!!
