Solved

Can't make PHPMailer-FE work

Posted on 2010-08-18
46
1,264 Views
Last Modified: 2013-12-13
I am trying to create a form that simply sends an email as Webmaster of Ohlhoff.org.  I asked another question with respect to this:

http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Microsoft_IIS/Q_26337303.html

..but that attempt is failing and I have more information about what is going on so I think this is a new question.  Apparently I have to install a mailer because they don't have anything installed?

The DNS company (Parcom) has a notification

http://kb.parcom.net/article.aspx?id=10169&cNode=7K6H5U

about a requirement for authentication and another page talking about acceptable email domains:

http://www.parcom.net/guides/parcom_SMTP_outgoing_mail_servers.htm

I decided to try this worx PHPmailer-EF "email to form"

http://sourceforge.net/projects/phpmailer/files/phpmailer-fe/PHPMailer-FE%20v4.0.6/PHPMailer-FE_v4.0.6.tar.gz/download

So I have unzipped this and uploaded the _lib and sample_forms directories to the Ohlhoff domain and I tried running one of the simple scripts.  I guess I haven't included any of the (necessary?--I guess) authentication to my script-- I am not sure where to put it.  I tried running a script anyway and right now it has been hanging for probably about an hour on this page:

http://ohlhoff.org/_lib/phpmailer-fe.php

I was trying to do this form:

http://ohlhoff.org/sample_forms/form.html

HOw am I going to make this work?




PhPmailer-form.png
0
Comment
Question by:kayvey
  • 36
  • 10
46 Comments
 
LVL 10

Expert Comment

by:iamanindian
ID: 33509460
A few quick observation & queries:

(1) Can you please share the code that you are using?
(2) Why don't you try & run a simple one liner script like:
-------------------------------------------------------------------------------
<?php
if(mail('yourtestmailid@example.com', 'Test Test', 'Hello world!'))
{
echo "Mail marked for delivery.";
}
else
{
echo "Failed!";
}
?>
-------------------------------------------------------------------------------
Then see what the output tells you.

(3) Since you are using Win2003, you will need to see what your outgoing mail server is. Check with your hosting provider & get the outgoing mail server info (which you will need to set on php.ini - as SMTP configuration).
e.g.
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

You may also give a thought on changing the SMTP Relay Restrictions from 'Only the list below' (which is empty by default) to 'All except the list below' . This setting is found in the Access tab of the SMTP server's properties.
0
 

Author Comment

by:kayvey
ID: 33590957
I put your code up

http://ohlhoff.org/iamanindian.html

let's see.....

[kayve@localhost ~]$ cd public_html/
[kayve@localhost public_html]$ ls
chess_yoga  CSc848  kayve  MicrosoftFonts  ohlhoff  ohlhoff.org.20100708
[kayve@localhost public_html]$ cd ohlhoff
[kayve@localhost ohlhoff]$ ls
Email.php       faq2.html  mail.php             PHPMailer-FE_v4.0.6.tar.gz
email.php.html  faqs.html  PHPMailer-FE_v4.0.6  wwwroot
[kayve@localhost ohlhoff]$ cd wwwroot/
[kayve@localhost wwwroot]$ ls
about.html       faq2.html                 involved.html        primary.html
adolescent.html  faq2.html.20100711        links.html           programs.html
adult.html       faq2.html.good            mail.php             recognition.html
aspnet_client    faqs.html                 mens.html            resources.html
blank.gif        googlehostedservice.html  myscripts            staff.html
cgi-bin          history.html              outpatient.html      staff-old.html
clients.html     _holding.htm              outpatient-old.html  success.html
contact.html     images                    pdfs                 value.html
excellence.html  index.html                philosophy.html      :w
facilities.html  index.test.html           phpform              womens.html
[kayve@localhost wwwroot]$ pwd
/home/kayve/public_html/ohlhoff/wwwroot
[kayve@localhost wwwroot]$ vi iamanindian.html
[kayve@localhost wwwroot]$ ls
about.html       faq2.html.20100711        links.html           recognition.html
adolescent.html  faq2.html.good            mail.php             resources.html
adult.html       faqs.html                 mens.html            staff.html
aspnet_client    googlehostedservice.html  myscripts            staff-old.html
blank.gif        history.html              outpatient.html      success.html
cgi-bin          _holding.htm              outpatient-old.html  value.html
clients.html     iamanindian.html          pdfs                 :w
contact.html     images                    philosophy.html      womens.html
excellence.html  index.html                phpform
facilities.html  index.test.html           primary.html
faq2.html        involved.html             programs.html
[kayve@localhost wwwroot]$ cd phpform
[kayve@localhost phpform]$ ls
Class.phpmailer.php  Email.php  mail.php  WS_FTP.LOG
[kayve@localhost phpform]$


Class.phpmailer.php  Email.php  mail.php  WS_FTP.LOG
[kayve@localhost phpform]$ cat Email.php
<?php
require("class.phpmailer.php");
# some settings of POST vars
if (!isset($_POST['state']))  $state = ''; else $state = $_POST['state'];
if (!isset($_POST['toText'])) $toText = ''; else $toText = $_POST['toText'];
if (!isset($_POST['subjectText'])) $subjectText = ''; else $subjectText = $_POST['subjectText'];
if (!isset($_POST['msgText'])) $msgText = ''; else $msgText = $_POST['msgText'];
if (!isset($_POST['ccText'])) $ccTexth = ''; else $ccText = $_POST['ccText'];
if (!isset($_POST['bccText'])) $bccText = ''; else $bccText = $_POST['bccText'];
if (!isset($_POST['nameText'])) $nameText = ''; else $nameText = $_POST['nameText'];
if (!isset($_POST['fromText'])) $fromText = ''; else $fromText = $_POST['fromText'];

if ($state == "") {
    $title="Test Email Page";
    $announce="---";
}
else {
//  $ccText="";
  $toText="Kayvey@mail.ohlhoff.org";
        $title="Test Email Page";
  $announce="Your Message has been Sent!";
        $header = "MIME-Version: 1.0\r\n";
        $header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
        $header .= "From: ".$fromText."\r\n";
        $header .= "Cc: ".$ccText."\r\n";
//      $header .= "Reply-To : ".$fromText."\r\n";
        $header .= "X-Priority: 1\r\n";
        $header .= "X-Mailer: PHP\r\n\r\n";
//      ini_set(sendmail_from,$fromText);  
//      ini_restore(sendmail_from);
 ini_set("SMTP","69.90.236.51");
 ini_set("smtp_port", "25");
 ini_set("sendmail_from","Kayvey@mail.ohlhoff.org");
 ini_set("username","Kayvey@mail.ohlhoff.org");
 ini_set("password", "---");
        mail($toText, $subjectText, $msgText, $header);
 echo "ini_set errors:\n";
 echo ini_set('display_errors');
 $mail = new PHPMailer();
 $mail->From = $fromText;
 $mail->Host = "mail.ohlhoff.org";
 $mail->Mailer = "smtp";
 $mail->AddAddress("kayvey@mail.ohlhoff.org");
 $mail->Subject = $subjectText;
 $mail->Body = $msgText;
 $mail->SMTPAuth = "true";
 $mail->Username = "kayvey@mail.ohlhoff.org");
 $mail->Password="---";
 $mail->Send();
}
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo($title)?></title>
<style type="text/css">
<!-- 
A:link { color: #999999; }
A:visited { color: #999999; }
A:hover {color: #0099ff;}
-->
</style>

</head>

<body bgcolor="#ddeedd">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" summary="" width="580">
<tr><td align="center">
<?php echo "self is ($PHP_SELF)"?>
<?php
        echo ("State: ".$state."&nbsp;&nbsp;To: ".$toText."<br>\nSubject: ".$subjectText."<br>\n".$msgText."<br>\ncc: ".$header);
?>

<p><b><font color="#000000" size="5">Test Email</font></b></p>
<font size="4" color="#000000">

<   <form method="POST" action="<?php echo($PHP_SELF)?>"> >
  <!--form method="POST" action="Email.php"-->
    <p><font size="3"><b>Name: <input type="text" name="nameText" size="46"></b></font></p>
    <p><font size="3"><b>Email: <input type="text" name="fromText" size="46"></b></font></p>
    <input type="hidden" name="subjectText" value="Web Mail"></p>
    <input type="hidden" name="mailformat" value="Text"></p>
    <p><font face="Arial" size="3"><b>Message Text:</b></font></p>
    <p><font face="Arial" size="3"><b><textarea rows="6" name="msgText" cols="60"></textarea></b></font></p>
    <p><font size="3"><b><input type="submit" value="Send" name="send" style="font-family: Arial; font-size: 12pt; font-weight: bold"></b></font></p>
    <input type="hidden" name="state" value="1">
  </form>
  <b><font face="Arial" size="4" color="#e00000"><?php echo($announce)?></font></b><br><br>

<input type=button value="Or Cancel - close This Window" onClick="javascript:window.close();">

</font>
</td></tr>
</table> 
</div>


</body>
</html>

[kayve@localhost phpform]$

Open in new window

0
 

Author Comment

by:kayvey
ID: 33591027
Maybe a bunch of gunk.. If you can't access this page:

http://kb.parcom.net/article.aspx?id=10169&cNode=7K6H5U

Here is the content:
Parcom we require that your web scripts/forms authenticate against our mail servers.  This is for security reasons of course, and to prevent unauthorized use by spammers.    

NOTE: This is just a sample, you are still responsible for knowing "how to implement" this code into your site.   Parcom does not provide coding support, rather we give you tips from other clients that do know how to implement these things.  If you need help contact a developer or participate in our forum.

The basic information that you would need for PHP forms are as follows:

This is just a sample of what could be within your code (please adjust accordingly)

 ini_set("SMTP","mail.yourdomain.com");

 ini_set("smtp_port","25");

 ini_set("sendmail_from","fromYou@typeyourdomainhere.com");

 

 

* Generally you would also pass a "password" variable which will include your POP Mail password.

 

Notes:


SMTP: This is your mail server, and it is important that you have the "mail" part.

PORT: The port is the standard port used by the server and this too is important to have.

FROM: Your e-mail address must be something that already exists on your mail account.  You cannot use ALIASES!

Open in new window

0
 

Author Comment

by:kayvey
ID: 33591108
.. but I am not doing something right..   Here are a couple of screenshots.. I am not sure where you got this "Windoze 2003 (?)" umm.. yeah I might have had uncle bill in  at one point.. but I am not an Admin for the folks at Parcom--truncate the URL from a previous post if necessary-- they are the ones who decided to run  IIS (or somehing?).  Right now I popped my CentOS into the internal bay

http://www.monkeyview.net/id/965/fsck/sfsu/P5120019.vhtml
ftpPHP.png
ftpPHP-lib.png
0
 

Author Comment

by:kayvey
ID: 33591186
OK the discussion of "SMTP outgoing mail server" is slightly confusing to me.  I have never messed with clientside MUAs for myself.  I have either logged onto a mail server via SSH or used WebMail.  This question shouldn't have anything to do with a personal MUA.  The request from Ohlhoff was to make a web page with a form that would send an email, to make it easier for folk to browse to their site and get help with their addictions.  

The Parcom company, which is the DNS provider for Ohlhoff, and thus me in this assignment, has required some sort of authentication process that I am not understanding in order to fulfill this request.  
0
 

Author Comment

by:kayvey
ID: 33591266
That is my take, anyway.  If I am confused, forgive me.  
0
 

Author Comment

by:kayvey
ID: 33591279
According to the specifications, you should be able to use the Ohlhoff form to send an email.  I think I have it set to send it to me, but the final version will be sent to the person in charge of Ohlhoff.  
0
 

Author Comment

by:kayvey
ID: 33591324
It might be necessary for the form to send email to an Ohlhoff.org email.  Here is a screenshot of my current CentOS with the web mail access to my kayvey@ohlhoff.org email.  
ohlhoff.mail.png
0
 

Author Comment

by:kayvey
ID: 33591457
Here is one more screenshot.  YOu can see my local machine path on the right.. /home/kayve .. that is my laptop running CentOS and I am using this FTP GUI to send stuff to the Parcom server, whose filesystem, it has a chroot path hiding mechanism of some sort, is on the right, so /wwwroot will appear as www.ohlhoff.org and /wwwroot/phpform will be at www.ohlhoff.org/phpform, etc.  
ftpPHP.png
0
 

Author Comment

by:kayvey
ID: 33591459
sorry.. local machine is on the LEFT and parcom is on the RIGHT
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 33592818
Let me check all your posts (quite a few :) ) & then get back.
0
 

Author Comment

by:kayvey
ID: 33602093
OK  {:)
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 33603730
You need to put my code snippet as part of a php file (not html). So, http://ohlhoff.org/iamanindian.html should actually be http://ohlhoff.org/iamanindian.php

Some changes in the script that I provided initially:
-------------------------------------------------------------------------------------------------------------------
<?php
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","webmaster@ohlhoff.org");//assuming this webmaster account already exists

if(mail('givesomevalidemailid@example.com', 'Test Test', 'Hello world!'))
{
   echo "Mail marked for delivery.";
}
else
{
   echo "Failed!";
}
?>
-------------------------------------------------------------------------------------------------------------------

Lets see how this goes.

Thanks & regards
0
 

Author Comment

by:kayvey
ID: 33605104
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 33605439
Ok, lets try a new snippet. Please update it according to your PhpMailer location. This should give us some debugging info. If there is a provision, you may also give me an FTP access - so that I may do a few rounds of trials & then get it working.
<?php
require("class.phpmailer.php");

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Host = "mail.ohlhoff.org";
$mail->SMTPAuth = true; 
$mail->Username = "kayvey@mail.ohlhoff.org");
$mail->Password="---";

$mail->From = "webmaster@ohlhoff.org";
$mail->FromName = "Web Master"; 
$mail->AddAddress("kayvey@mail.ohlhoff.org");
$mail->Subject = "Test Email from INN";
$mail->Body = "Hello world!";

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

Open in new window

0
 

Author Comment

by:kayvey
ID: 33675434
OK, man.. sorry for the delay

http://ohlhoff.org/phpform/iaman2.php

just blank.  weird.  

On giving you the password.. I don't feel it is necessary, although you have a point.  I am certainly not going to post it on the internet here.  To give you the FTP, I'll need your email.  Why don't we try another round or so of doing it this way, and see how it goes.  I am going to be a lot faster on the returns now.  
0
 

Author Comment

by:kayvey
ID: 33675453
Just a note-- I wasn't able to FTP via sftp on the command line or ftp on the comand line.  I installed something called gFTP on Gentoo and CentOS, and that has worked  I will be swapping my harddrive out (I don't dual boot-- I screwdriver swap hard drives into my laptop's internal bay to change operating systems, and then use external enclosures sometimes to mount them on each other) to CentOS soon.  
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 33678951
Not sure weather in your Php configuration errors are supressed or not. TO help debugging...let's print a few lines...

Please upad & advise.

Thanks & regards
<?php

require("class.phpmailer.php");

echo "Preparing for mail...<br/>";

$mail = new PHPMailer();

echo "Mailer ready...<br/>";

$mail->IsSMTP();

$mail->SMTPDebug  = 2;

$mail->Host = "mail.ohlhoff.org";

$mail->SMTPAuth = true; 

$mail->Username = "kayvey@mail.ohlhoff.org");

$mail->Password="---";



$mail->From = "webmaster@ohlhoff.org";

$mail->FromName = "Web Master"; 

$mail->AddAddress("kayvey@mail.ohlhoff.org");

$mail->Subject = "Test Email from INN";

$mail->Body = "Hello world!";



echo "Going to send mail...<br/>";



if(!$mail->Send()) {

	echo 'Message was not sent.';

	echo 'Mailer error: ' . $mail->ErrorInfo;

} else {

	echo 'Message has been sent.';

}

echo "Process over!<br/>";



?>

Open in new window

0
 

Author Comment

by:kayvey
ID: 33686210
upad = upload I assume?
0
 

Author Comment

by:kayvey
ID: 33686814
0
 

Author Comment

by:kayvey
ID: 33686867
http://ohlhoff.org/phpform/iaman3.php

Still nothing.. btw.. did I show you this one?

oops.. never mind

Hi all,
I am setting up my website, but the email did not work.
I tried the following script (I got from this forum with some modification). The script display blank page when I access it. I have put some echo command to see if the script works or not, but it still shows the blank page. I have put the "class.phpmailer.php" in the same folder. I tried to make some syntax error, but no error message shown in the page. It still blank pages shown.
Is there something wrong? Please help.

Regards,
Ramzi













==================

require("class.phpmailer.php");
echo "helloo......"; // this is a test if the script works.
$mail = new PHPMailer(); //Create PHPmailer class
$mail->From = "****admin@batamjobs.com"; //Sender address
$mail->FromName = "Site admin"; //The name that you'll see as Sender
$mail->Host = "mail.batamjobs.com"; //Your SMTP mail server
$mail->Mailer = "smtp"; //Protocol to use
$mail->AddAddress("****@gmail.com"); //The address you are sending mail to
$mail->Subject = "Test Mail Subject"; //Subject of the mail
$mail->Body = "This is my mail body"; //Body of the message
$mail->SMTPAuth = "true";
$mail->Username = "****admin@batamjobs.com";
$mail->Password = "******";
if(!$mail->Send()){ //Check for result of sending mail
echo "There was an error sending the message"; //Write an error message if mail isn't sent
exit; //Exit the script without executing the rest of the code
}else{
echo "success....";
}
=================


Scott - EzyAuctioNZ.co.nzUser is Offline
Basic Member
Basic Member
Posts:118

--       
01/28/2010 01:40 AM       QuoteQuote ReplyReply AlertAlert
Have you used the php opening and closing tags ?

Cheers,
Scott
http://www.ezyauctionz.co.nz
ramziUser is Offline
New Member
New Member
Posts:4

--       
01/28/2010 03:08 AM       QuoteQuote ReplyReply AlertAlert
Yes, I have.

sbishopUser is Offline
New Member
New Member
Posts:1

--       
01/28/2010 10:05 AM       QuoteQuote ReplyReply AlertAlert
I am having trouble too. The strange thing is I have a number of pages that send email, some that have worked for months. Then all of a sudden I get word that one isn't working, and I haven't made any changes. One thing that I have done to get things going again is switching back to the class.phpmailer.php version for PHP4, or vice versa other times! I did a line-by-line comparision between your code and mine and I did find that you had three lines I am not currently using. I seem to get by without:
$mail->SMTPAuth = "true";
$mail->Username = "****admin@batamjobs.com";
$mail->Password = "******";
Of course, as I said above, not all of my scripts are trouble free either. I also have a line that doesn't appear in your code:
$mail->IsSMTP();
But I am thinking that that is the same as your line:
$mail->Mailer = "smtp"; //Protocol to use
Although I have that line in my code as well.

I'm sorry, I am not sure I am really helping - but maybe if you have some luck you will let me know.

-Scott
ramziUser is Offline
New Member
New Member
Posts:4

--       
01/28/2010 07:22 PM       QuoteQuote ReplyReply AlertAlert

Thanks Scott,

My script had been working now. What I did: re-download the PHPmailer class, unzipped it, and uploaded everything to my server. After that, the script run well. I tried another script that using phpmailer. It run well too.

Regards,
Ramzi
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 33688825
Since no error message are showing up, add the following lines as the first few lines of the script that I had provided earlier.
-----------------------------------------------------------------------------------------------
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
echo "Going to include PhpMailer Script....";
require("class.phpmailer.php");
echo "Preparing for mail...<br/>";
..
....
......
-----------------------------------------------------------------------------------------------
What does this show now?

Thanks & regards
0
 

Author Comment

by:kayvey
ID: 33696885
Thank ME thank YOU!!  {:P  sheesh d00d {:D

umm.. 'tay.. ummm
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:kayvey
ID: 33696929
gee.. uhh.. didn't you see this page?

http://kb.parcom.net/article.aspx?id=10169&cNode=7K6H5U

 ini_set("SMTP","mail.yourdomain.com");
 ini_set("smtp_port","25");
 ini_set("sendmail_from","fromYou@typeyourdomainhere.com");

I'm slightly lost, I am just continuing to comply..
 
0
 

Author Comment

by:kayvey
ID: 33696962
0
 

Author Comment

by:kayvey
ID: 33697160
http://ohlhoff.org/phpform/iama5.php
[kayve@kayve phpform]$ cat iama5.php 
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@mail.ohlhoff.org");
echo ("Going to include PHPMailer Script....";
require("class.phpmailer.php");
echo "Preparing for mail...<br/>";
$mail = new PHPMailer();
echo "Mailer ready...<br/>";
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Host = "mail.ohlhoff.org";
$mail->SMTPAuth = true; 
$mail->Username = "kayvey AT mail DOT ohlhoff DOT org");
$mail->Password="---";

$mail->From = "webmaster@ohlhoff.org";
$mail->FromName = "Web Master"; 
$mail->AddAddress("kayvey AT mail DOT ohlhoff DOT org");
$mail->Subject = "Test Email from INN";
$mail->Body = "Hello world!";

echo "Going to send mail...<br/>";

if(!$mail->Send()) {
        echo 'Message was not sent.';
        echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
        echo 'Message has been sent.';
}
echo "Process over!<br/>";

?>

[kayve@kayve phpform]$

Open in new window

0
 

Author Comment

by:kayvey
ID: 33697166
oops.  missed one AT DOT DOT  {:D
0
 

Author Comment

by:kayvey
ID: 33697186
http://ohlhoff.org/phpform/iama6.php
[kayve@kayve phpform]$ cat iama6.php 
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@mail.ohlhoff.org");
echo ("Going to include PHPMailer Script....";
require("class.phpmailer.php");
echo "Preparing for mail...<br/>";
$mail = new PHPMailer();
echo "Mailer ready...<br/>";
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Host = "mail.ohlhoff.org";
$mail->SMTPAuth = true; 
$mail->Username = "kayvey@mail.ohlhoff.org");
$mail->Password="RuyO9..Bc5";

$mail->From = "kayvey@mail.ohlhoff.org";
$mail->FromName = "Web Master"; 
$mail->AddAddress("kayvey@mail.ohlhoff.org");
$mail->Subject = "Test Email from INN";
$mail->Body = "Hello world!";

echo "Going to send mail...<br/>";

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

Open in new window

0
 

Author Comment

by:kayvey
ID: 33697211
http://ohlhoff.org/phpform/iama7.php
[kayve@kayve phpform]$ cat iama7.php 
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@ohlhoff.org");
echo ("Going to include PHPMailer Script....";
require("class.phpmailer.php");
echo "Preparing for mail...<br/>";
$mail = new PHPMailer();
echo "Mailer ready...<br/>";
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Host = "mail.ohlhoff.org";
$mail->SMTPAuth = true; 
$mail->Username = "kayvey@ohlhoff.org");
$mail->Password="----";

$mail->From = "kayvey@ohlhoff.org";
$mail->FromName = "Web Master"; 
$mail->AddAddress("kayvey@ohlhoff.org");
$mail->Subject = "Test Email from INN";
$mail->Body = "Hello world!";

echo "Going to send mail...<br/>";

if(!$mail->Send()) {
        echo 'Message was not sent.';
        echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
        echo 'Message has been sent.';
}
echo "Process over!<br/>";

?>

[kayve@kayve phpform]$

Open in new window

0
 

Author Comment

by:kayvey
ID: 33697218
OH NO OH NO I LEFT THE PASSWORD IN!  (not the right one.. oer)
0
 

Author Comment

by:kayvey
ID: 33706697
Maybe I screwed this up:

This PHP application includes many options, but we are focusing on simple use of authentication protocol. The installation need a folder (Ex. /PHPmailer) and 2 classes:

    * class.phpmailer.php
    * class.smtp.php

These are the 2 files you must have in your new folder with the /language folder.

http://www.hellotutorials.com/tutorials.php?id=1
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 33707502
Just curious...is your PHP configuration itself working fine? i.e. if you try & print phpinfo, does it come out correctly?

<?php
phpinfo();
?>

I am curious...as no errors showed up in the previous scripts....neither did the print work.

Regards
0
 

Author Comment

by:kayvey
ID: 33720062
I don't know if they are turning it off and back on or what.  I thought I had a form up somebody gave me from the other question, but now I can't find it.  Give me a sec..
0
 

Author Comment

by:kayvey
ID: 33720081
well.. that seems to be working..

http://ohlhoff.org/phpform/test.php
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 33727360
Ok, that is good news. So it does appear that "display_errors" is set off.
Now...if you run http://ohlhoff.org/phpform/iama7.php with a slight modification like...

<?php
echo "Hello world!<br/>";
ini_set('display_errors', 1);
echo "Error Display:";
echo ini_get('display_errors');
ini_set('error_reporting', E_ALL);
echo "<br/>Error Reporting:";
echo ini_get('error_reporting');
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@ohlhoff.org");
echo "<br/>SMTP:";
echo ini_get('SMTP');
....
......
?>

What does it look like?

Thanks & regards
0
 

Author Comment

by:kayvey
ID: 33728243
OK.  I changed the name...

http://ohlhoff.org/iama8.php
http://ohlhoff.org/phpform/iama8.php

but this is really strange, huh?

http://ohlhoff.org/phpform/iama9.php
[kayve@localhost phpform]$ cat iama9.php 
<?php
phpinfo();
echo"Hello world!<br/>";
ini_set('display_errors', 1);
echo"Error Display:";
echo ini_get('display_errors');
ini_set('error_reporting', E_ALL);
echo"<br/>Error Reporting:";
ini_set('error_reporting');
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@ohlhoff.org");
echo "<br/>SMTP:";
echo ini_set('SMTP');
echo ("Going to include PHPMailer Script....";
require("class.phpmailer.php");
echo "Preparing for mail...<br/>";
$mail = new PHPMailer();
echo "Mailer ready...<br/>";
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Host = "mail.ohlhoff.org";
$mail->SMTPAuth = true; 
$mail->Username = "kayvey@ohlhoff.org");
$mail->Password="RuyO9..Bc5";

$mail->From = "kayvey@ohlhoff.org";
$mail->FromName = "Web Master"; 
$mail->AddAddress("kayvey@ohlhoff.org");
$mail->Subject = "Test Email from INN";
$mail->Body = "Hello world!";

echo "Going to send mail...<br/>";

if(!$mail->Send()) {
        echo 'Message was not sent.';
        echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
        echo 'Message has been sent.';
}
echo "Process over!<br/>";

?>

[kayve@localhost phpform]$

Open in new window

0
 

Author Comment

by:kayvey
ID: 33728247
OK wait...
0
 

Author Comment

by:kayvey
ID: 33728277
okay.. can you make sense of what is happening??

http://ohlhoff.org/phpform/test2.php
[kayve@localhost phpform]$ cat test2.php 
<?php
phpinfo();
echo "Hello world!<br/>";
 
ini_set('display_errors', 1);
echo "Error Display:";
echo ini_get('display_errors');
ini_set('error_reporting', E_ALL);
echo "<br/>Error Reporting:";
echo ini_get('error_reporting');
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@ohlhoff.org");
echo "<br/>SMTP:";
echo ini_get('SMTP');
?>
[kayve@localhost phpform]$

Open in new window

0
 

Author Comment

by:kayvey
ID: 33728296
oh maybe you want this too
[kayve@localhost phpform]$ cat iama8.php 
<?php
echo"Hello world!<br/>";
ini_set('display_errors', 1);
echo"Error Display:";
echo ini_get('display_errors');
ini_set('error_reporting', E_ALL);
echo"<br/>Error Reporting:";
ini_set('error_reporting');
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@ohlhoff.org");
echo "<br/>SMTP:";
echo ini_set('SMTP');
echo ("Going to include PHPMailer Script....";
require("class.phpmailer.php");
echo "Preparing for mail...<br/>";
$mail = new PHPMailer();
echo "Mailer ready...<br/>";
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Host = "mail.ohlhoff.org";
$mail->SMTPAuth = true; 
$mail->Username = "kayvey@ohlhoff.org");
$mail->Password="RuyO9..Bc5";

$mail->From = "kayvey@ohlhoff.org";
$mail->FromName = "Web Master"; 
$mail->AddAddress("kayvey@ohlhoff.org");
$mail->Subject = "Test Email from INN";
$mail->Body = "Hello world!";

echo "Going to send mail...<br/>";

if(!$mail->Send()) {
        echo 'Message was not sent.';
        echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
        echo 'Message has been sent.';
}
echo "Process over!<br/>";

?>

[kayve@localhost phpform]$

Open in new window

0
 

Author Comment

by:kayvey
ID: 33728350
Just to make sure something REALLY weird isn't happening.. umm.. just verifying what we are seeing...

I am not seeing anything or any of the iama[#] URIs.. but test.php I see this nicely formated purple page with all the nice infos.. test2.php I see the same thing plus this:


Hello world!
Error Display:1
Error Reporting:2047
SMTP:mail.ohlhoff.org
test2.png
0
 

Author Comment

by:kayvey
ID: 33730012
I'm not seeing anyting ON the iama[#] URIs is what I meant to say.  Maybe it makes sense both ways anyway  {:D
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 33731212
Ok, I meant to try this code...


<?php
echo "Hello world!<br/>";
ini_set('display_errors', 1);
echo "Error Display:";
echo ini_get('display_errors');
ini_set('error_reporting', E_ALL);
echo "<br/>Error Reporting:";
echo ini_get('error_reporting');
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@ohlhoff.org");
echo "<br/>SMTP:";
echo ini_get('SMTP');
echo " From: ";
echo ini_get("sendmail_from");
echo "Going to include PHPMailer Script....";
require_once("class.phpmailer.php");
echo "Preparing for mail...<br/>";
$mail = new PHPMailer();
echo "Mailer ready...<br/>";
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Host = "mail.ohlhoff.org";
$mail->SMTPAuth = true; 
$mail->Username = "kayvey@ohlhoff.org");
$mail->Password="----";
$mail->From = "kayvey@ohlhoff.org";
$mail->FromName = "Web Master"; 
$mail->AddAddress("kayvey@ohlhoff.org");
$mail->Subject = "Test Email from INN";
$mail->Body = "Hello world!";

echo "Going to send mail...<br/>";

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

Open in new window

0
 

Author Comment

by:kayvey
ID: 33750652
oh I forgot to tell you

http://ohlhoff.org/phpform/test4.php

http://ohlhoff.org/phpform/test3.php
p 
[kayve@localhost phpform]$ cat test3.php
<?php
echo "Hello world!<br/>";
ini_set('display_errors', 1);
echo "Error Display:";
echo ini_get('display_errors');
ini_set('error_reporting', E_ALL);
echo "<br/>Error Reporting:";
echo ini_get('error_reporting');
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@ohlhoff.org");
echo "<br/>SMTP:";
echo ini_get('SMTP');
echo " From: ";
echo ini_get("sendmail_from");
echo "Going to include PHPMailer Script....";
require_once("class.phpmailer.php");
echo "Preparing for mail...<br/>";
$mail = new PHPMailer();
echo "Mailer ready...<br/>";
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Host = "mail.ohlhoff.org";
$mail->SMTPAuth = true; 
$mail->Username = "kayvey@ohlhoff.org");
$mail->Password="----";
$mail->From = "kayvey@ohlhoff.org";
$mail->FromName = "Web Master"; 
$mail->AddAddress("kayvey@ohlhoff.org");
$mail->Subject = "Test Email from INN";
$mail->Body = "Hello world!";

echo "Going to send mail...<br/>";

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

[kayve@localhost phpform]$

Open in new window

0
 

Author Comment

by:kayvey
ID: 33750653
and
[kayve@localhost phpform]$ cat test4.php
<?php
 phpinfo();
echo "Hello world!<br/>";
ini_set('display_errors', 1);
echo "Error Display:";
echo ini_get('display_errors');
ini_set('error_reporting', E_ALL);
echo "<br/>Error Reporting:";
echo ini_get('error_reporting');
ini_set("SMTP","mail.ohlhoff.org");
ini_set("smtp_port","25");
ini_set("sendmail_from","kayvey@ohlhoff.org");
echo "<br/>SMTP:";
echo ini_get('SMTP');
echo " From: ";
echo ini_get("sendmail_from");
echo "Going to include PHPMailer Script....";
require_once("class.phpmailer.php");
echo "Preparing for mail...<br/>";
$mail = new PHPMailer();
echo "Mailer ready...<br/>";
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Host = "mail.ohlhoff.org";
$mail->SMTPAuth = true; 
$mail->Username = "kayvey@ohlhoff.org");
$mail->Password="----";
$mail->From = "kayvey@ohlhoff.org";
$mail->FromName = "Web Master"; 
$mail->AddAddress("kayvey@ohlhoff.org");
$mail->Subject = "Test Email from INN";
$mail->Body = "Hello world!";

echo "Going to send mail...<br/>";

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

[kayve@localhost phpform]$

Open in new window

0
 
LVL 10

Accepted Solution

by:
iamanindian earned 500 total points
ID: 33762817
Perhaps you can email me (arijit.sarbagna@innindia.com) your server credentials - for me to explore. I am bit confused looking at the current behavior. :(

Regards
0
 

Author Closing Comment

by:kayvey
ID: 33801177
     1 <?php
      2 ini_set('error_reporting', E_ALL);
      3 ini_set('display_errors', 1);
      4 ini_set("SMTP","mail.ohlhoff.org");
      5 ini_set("smtp_port","25");
      6 ini_set("sendmail_from","kayvey@mail.ohlhoff.org");
      7 $headers = "From: Web Master \r\nReply-To: webmaster@ohlhoff.org";
      8 $to = 'kayvey@gmail.com';
      9 $subject = 'Test Email from INN';
     10 $message = "Hello World!\n\nThis is my mail.";
     11
     12 $toEmail[0]="kayvey@ohlhoff.org";
     13 $toEmail[1]="arijit.sarbagna@gmail.com";
     14 $toEmail[2]="kayvey@gmail.com";
     15 for($i=0;$i";
     19         }else{
     20                 echo "Gosh! Couldn't send mail!";
     21         }
     22 }
     23 ?>
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now