TechTalkz.com Logo Ask the Experts!

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Programing Languages > PHP

using phpMailer

PHP


Reply
 
LinkBack Thread Tools Display Modes
Old 05-09-2007, 06:00 AM   #1
Kevin Raleigh
Guest
 
Posts: n/a
using phpMailer

I would like to use the phpMailer.
Haven't used it before but I am told that it is the way to go.
Anyway does anyone have any experience using the phpMailer

What I have done thus far is to load the files to my server and include them
into the php.ini file. this part works fine.

But when I call the file mailTest.php "see code below" it sends this error:
Warning: fsockopen() expects parameter 2 to be long, string given in
/home/content/r/a/l/raleigh123/html/php/class.smtp.php on line 105
Message could not be sent.
Mailer Error: Language string failed to load: connect_host



Now when I contacted my provider godaddy.com for information they told me
that I had to use this string in my code in place of the username and
password: ( relay-hosting.secureserver.net ) minus the parenthesis of
course. However I don't know where to put this piece of information into the
phpMailer code.

I scanned the class.smtp file and the class.phpMailer file but couldn't find
anywhere that the information would fit.

I am using one of the test scripts that come with phpMailer:


<?php
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();

// set mailer to use SMTP
$mail->Host = "http://www.mysite.org";
//relay-hosting.secureserver.net

// specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication


$mail->Username = "jondoe"; // SMTP username
$mail->Password = "ADeer"; // SMTP password

$mail->From = "from@example.com";
$mail->FromName = "Mailer";
$mail->AddAddress("mysite@site.com", "Kevin Raleigh");
//$mail->AddAddress("ellen@example.com");

// name is optional
//$mail->AddReplyTo("info@example.com", "Information");

$mail->WordWrap = 50;

// set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz");

// add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");

// optional name
$mail->IsHTML(true);

// set email format to HTML

$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

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

echo "Message has been sent again";
?>

Can anyone advise me on how to work with phpMailer
Your insights would be greatly appreciated

thank you

Kevin




  Reply With Quote
Old 05-09-2007, 06:00 AM   #2
Kevin Raleigh
Guest
 
Posts: n/a
Re: using phpMailer

I am using godaddy.com to send emails and after working with their tech
support and the great guys that support phpmail I was able to resolve the
problem.
Using the test script below you can send emails if you make the following
changes.
1)set the following path to
// set mailer to use SMTP
$mail->Host = " relay-hosting.secureserver.net";

2) comment out isSMTP() located at the top of the file.

The problem is that godaddy will not allow you to connect to the mail
server, and isSMTP() is trying to ascertain is the mail server exists. Since
you can't connect you get a connection error or a time out error.
Commenting out the isSMTP() allows you to send the mail direct without the
check which is the only was godaddy will allow you to do it.



here is the mailTest.php page that I used to send the email:

<?php
require("class.phpmailer.php");

$mail = new PHPMailer();

// don't use this line of code for godaddy.com
//$mail->IsSMTP();

// set mailer to use godaddy relay server
$mail->Host = "relay-hosting.secureserver.net";
//relay-hosting.secureserver.net

// specify main and backup server - not needed for godaddy relay server
//$mail->SMTPAuth = true; // turn on SMTP authentication

/* commented out as they are not needed
$mail->Username = "jondoe"; // SMTP username
$mail->Password = "ADeer"; // SMTP password
*/

$mail->From = "from@example.com";
$mail->FromName = "Mailer";
$mail->AddAddress("mysite@site.com", "john doe");
//$mail->AddAddress("ellen@example.com");

// name is optional
//$mail->AddReplyTo("info@example.com", "Information");

$mail->WordWrap = 50;

// set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz");

// add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");

// optional name
$mail->IsHTML(true);

// set email format to HTML

$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

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

echo "Message has been sent again";
?>

Just thought I would post this incase anyone ran into the same trouble I did
Thank You
Kevin Raleigh

"Kevin Raleigh" <kraleigh@sbcglobal.net> wrote in message
news:X4udndRSPs7vdxLbnZ2dnUVZ_hynnZ2d@giganews.com ...
> I would like to use the phpMailer.
> Haven't used it before but I am told that it is the way to go.
> Anyway does anyone have any experience using the phpMailer
>
> What I have done thus far is to load the files to my server and include

them
> into the php.ini file. this part works fine.
>
> But when I call the file mailTest.php "see code below" it sends this

error:
> Warning: fsockopen() expects parameter 2 to be long, string given in
> /home/content/r/a/l/raleigh123/html/php/class.smtp.php on line 105
> Message could not be sent.
> Mailer Error: Language string failed to load: connect_host
>
>
>
> Now when I contacted my provider godaddy.com for information they told me
> that I had to use this string in my code in place of the username and
> password: ( relay-hosting.secureserver.net ) minus the parenthesis of
> course. However I don't know where to put this piece of information into

the
> phpMailer code.
>
> I scanned the class.smtp file and the class.phpMailer file but couldn't

find
> anywhere that the information would fit.
>
> I am using one of the test scripts that come with phpMailer:
>
>
> <?php
> require("class.phpmailer.php");
>
> $mail = new PHPMailer();
>
> $mail->IsSMTP();
>
> // set mailer to use SMTP
> $mail->Host = "http://www.mysite.org";
> //relay-hosting.secureserver.net
>
> // specify main and backup server
> $mail->SMTPAuth = true; // turn on SMTP authentication
>
>
> $mail->Username = "jondoe"; // SMTP username
> $mail->Password = "ADeer"; // SMTP password
>
> $mail->From = "from@example.com";
> $mail->FromName = "Mailer";
> $mail->AddAddress("mysite@site.com", "Kevin Raleigh");
> //$mail->AddAddress("ellen@example.com");
>
> // name is optional
> //$mail->AddReplyTo("info@example.com", "Information");
>
> $mail->WordWrap = 50;
>
> // set word wrap to 50 characters
> //$mail->AddAttachment("/var/tmp/file.tar.gz");
>
> // add attachments
> //$mail->AddAttachment("/tmp/image.jpg", "new.jpg");
>
> // optional name
> $mail->IsHTML(true);
>
> // set email format to HTML
>
> $mail->Subject = "Here is the subject";
> $mail->Body = "This is the HTML message body <b>in bold!</b>";
> $mail->AltBody = "This is the body in plain text for non-HTML mail

clients";
>
> if(!$mail->Send())
> {
> echo "Message could not be sent. <p>";
> echo "Mailer Error: " . $mail->ErrorInfo;
> exit;
> }
>
> echo "Message has been sent again";
> ?>
>
> Can anyone advise me on how to work with phpMailer
> Your insights would be greatly appreciated
>
> thank you
>
> Kevin
>
>
>
>



  Reply With Quote
Reply

Thread Tools
Display Modes



< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +1. The time now is 03:36 AM.


vBulletin, Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2011, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional