Page 1 of 3

Suddenly I can't send email

PostPosted: 16. October 2009 18:52
by creacon
I have a web page that sends an email, and was working a few weeks ago. Now I've made another one using basically the same php code but the php mail() function now gives me the following error:

Warning: mail() [function.mail]: SMTP server response: 530 authentication required - "for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html" in C:\xampp\htdocs\IOD\WOTCPg3Test.php on line 136

Here's the code from my php script that gets the error:
Code: Select all
      $to       = "creacontech@yahoo.com";
      $from    = "creacontech@windstream.net";
      $headers = "From: $from";
      $subject = "WOTC Questionnaire Report Request";
      $message = $custident." has executed a WOTC Questionnaire for: <br />".
               $applname.", SSN ".$arrappl[ssn]." DOB ".$arrappl[dob]."<br />
               and has requested the following reports: <br />";
               
      for ($i=0; $i<=$numreps; $i++)
      {
         $message = $message.$arrpsel[$i].", ";
      }
      
      echo "<br /> To: = ".$to." From = ".$from."<br /> message = ".$message;
      

      if (mail($to,$subject,$message,$headers))
      {
         printf("The following email was sent:<br /><br />    To:  %s<br /><br />Subj:  %s<br />
               <br />Your WOTC Questionnaire for:<br /><br />  Name:  %s",
               $to,$subject,$arrappl[fullname]);
      }
      else
      {
         echo "<br />An ERROR was encountered and the email WAS NOT SENT<br />
         Contact your webmaster for assistance.<br /><br />";
      }
   


Can anyone tell me what the error message means by "...530 authentication required ? I can successfully send via Outlook from the above "From" address without a problem, and can also receive email via that account.

Also, I just discovered that if I upload my page to my remote host, the email works. That leads me to believe that the problem is somehow connected to my localhost, possibly with Mercury Mail. The problem is that I don't have a clue where or for what to look. Can someone help me?

Re: Suddenly I can't send email

PostPosted: 17. October 2009 00:38
by Izzy
creacon wrote:SMTP server response: 530 authentication required
This usually means you are trying to access your mail account without a username/password combination, which in Outlook you have supplied for this task and so would not give you an error message.

You can use Sendmail to do this which can be configured in the php.ini file and in the sendmail.ini file.

An Advanced forum search in the XAMPP for Windows forum using keyword sendmail should give you some useful and helpful results.

If you get stuck using the sendmail feature post back and someone will try and sort it for you.

Good luck

Re: Suddenly I can't send email

PostPosted: 19. October 2009 17:02
by creacon
Thanks a million Izzy! I had an uncle with that nickname; his real name was isadore pepitone.

I did the search you reccommended, and found a similar topic by "Amanda" in which you explained how to set up the php.ini and sendmail.ini. I followed your obstructions (?) and VOILA! it worked; and least I think it did. I sent it to myself (i.e. from my Yahoo mail account to my ISP account). In my php script I do an if mail()... and a printf message for true and one for false, and the True message printed. I haven't been able to receive my email yet because something is wrong at my ISP; when I try do download my email, Outlook keeps timing out, and when I try to look at it on webmail, it takes as much as 5 minutes just to open one message.

Anyway, thanks again for your help. I really appreciate it.

Re: Suddenly I can't send email

PostPosted: 20. October 2009 15:30
by creacon
Well I guess this is an OOPS! The phone company finally fixed my DSL problem so now I can get my email at my home email address. So now there's apparently another a problem. The page indicates that the mail has been sent (i.e. I get the Success message), but when I open Outlook to receive mail, nothing comes in. I've also looked via Web Mail, both at my ISP's site (where I should be receiving it), and my Yahoo site (which is the sending email address).

Any ideas about what could be causing this?

Re: Suddenly I can't send email

PostPosted: 20. October 2009 22:22
by Izzy
If you used sendmail then there is a sendmail.log file in the \xampp\sendmail folder.

Other than that it would need you to supply the details of your php.ini mail section configuration and your sendmail configuration plus your script code especially any error messages reported by your script.

Re: Suddenly I can't send email

PostPosted: 20. October 2009 23:16
by creacon
Thanks, I'd forgotten about the log file. Turns out there was an error message for each of my attempts (there's a surprise). Here's the message (I haven't a clue what it means, let alone how to fix it):

Oct 20 11:12:15 host=smtp.bizmail.yahoo.com tls=on auth=on user=rob@creacontech.com from=rob@creacontech.com recipients=creacontech@windstream.net errormsg='the server does not support TLS via the STARTTLS command' exitcode=EX_UNAVAILABLE

Here's my code that sends the email:

$to = "creacontech@windstream.net";
$from = "rob@creacontech.com";
$headers = "From: $from";
$subject = "WOTC Questionnaire Report Request";
$message = $cust." has executed a WOTC Questionnaire for: \n \n".
" ".$arrappl[fullname].", SSN: ".$arrappl[ssn].", DOB: ".$arrappl[dob].
", ".$arrappl[race].", ".$sex."\n Address: ".$address.", ".
$arrappl[city].", ".$arrappl[state].", ".$arrappl[zip].", Phone: ".
$arrappl[phone]."\n \n Recruited By: ".$arrappl[recname].", Title: "
.$arrappl[rectitl].", Phone: ".$arrappl[recphn].", Extn: ".$arrappl[recphnext].
"\n Address: ".$rcraddr.", ".$arrappl[reccity].", ".
$arrappl[recstate].", ".$arrappl[reczip]."\n Email: ".$arrappl[recemail].
"\n \n and has requested the following reports: \n \n";

for ($i=0; $i<=$numreps; $i++)
{
$message = $message.$arrpsel[$i]."; ";
}

if (mail($to,$subject,$message,$headers))
{
echo '<script type="text/javascript">alert("A WOTC Questionnaire email WAS SENT to Information On Demand." );</script>';

}
else
{
echo '<script type="text/javascript">alert("An ERROR was encountered and the email WAS NOT SENT. Contact Information On Demand for assistance.");</script>';
}



Any help w/be greatly appreciated.

Re: Suddenly I can't send email

PostPosted: 20. October 2009 23:59
by Izzy
Ok, we are moving in the right direction now.
I did the search you reccommended, and found a similar topic by "Amanda" in which you explained how to set up the php.ini and sendmail.ini.
Go back to this post and you will find the fix for
the server does not support TLS via the STARTTLS command'


Good luck.

Re: Suddenly I can't send email

PostPosted: 21. October 2009 15:49
by creacon
I revisited that post and amid my complete confusion, the best I could figure out was to change my "sendmail.ini" as follows:

Code: Select all
# A freemail service example
account Yahoomail
tls on
tls_starttls off (this is what I added, as shown in Amanda's post)
tls_certcheck off
host smtp.bizmail.yahoo.com
from rob@creacontech.com
auth on
user rob@creacontech.com
password [raisin4312]


That, however, did not work, but rather produced a different error:

Code: Select all
Oct 21 10:41:50 host=smtp.bizmail.yahoo.com tls=on auth=on user=rob@creacontech.com from=rob@creacontech.com recipients=creacontech@windstream.net smtpstatus=535 smtpmsg='535 authorization failed (#5.7.0)' errormsg='authentication failed (method PLAIN)' exitcode=EX_NOPERM


I seem to be moving in the wrong direction, and am completely confused about which, what and how?!?!?

Re: Suddenly I can't send email

PostPosted: 21. October 2009 18:15
by Wiedmann
errormsg='authentication failed (method PLAIN)'

What happens if you use:
Code: Select all
auth cram-md5

(instead of "auth on")

Re: Suddenly I can't send email

PostPosted: 21. October 2009 20:32
by creacon
What happens if you use:

Code: Select all
auth cram-md5



Tried it, and still no email. This time the error was:

Oct 21 15:28:08 host=smtp.bizmail.yahoo.com tls=on auth=on user=rob@creacontech.com from=rob@creacontech.com recipients=creacontech@windstream.net errormsg='the server does not support authentication method CRAM-MD5' exitcode=EX_UNAVAILABLE


Are we gaining on it????

Re: Suddenly I can't send email

PostPosted: 21. October 2009 20:44
by Izzy
Try
Code: Select all
auth login

Re: Suddenly I can't send email

PostPosted: 21. October 2009 23:12
by creacon
OOOOOOOOOOK! I tried that, and here's the error this time:

Oct 21 18:09:43 host=smtp.bizmail.yahoo.com tls=on auth=on user=rob@creacontech.com from=rob@creacontech.com recipients=creacontech@windstream.net smtpstatus=535 smtpmsg='535 authorization failed (#5.7.0)' errormsg='authentication failed (method LOGIN)' exitcode=EX_NOPERM



I wish I could report a better result. I know you've been working hard to help, and I certainly appreciate it.

Re: Suddenly I can't send email

PostPosted: 21. October 2009 23:34
by Izzy
Find out what port smtp.bizmail.yahoo.com uses for it's secure smtp connections and add that to the ini file much like in Amanda's post for GMail.

The default is port 25 and this may be the reason that secure connections are creating errors - use the original auth on entry but add the alternate secure port.

Re: Suddenly I can't send email

PostPosted: 22. October 2009 00:17
by creacon
After much searching an gnashing of teeth, I found the following article on yahoo help:

SMTP Port
If you have adjusted your SMTP server, and you're still experiencing a problem, you may need to use an alternate port. In an attempt to control spam, some Internet service providers now block port 25, which means you may need to use port 587 when sending email via Yahoo!'s SMTP server


So I obligingly added the line you suggested (it's the same line shown in one of Amanda's posts) - specifically "Port 587", and I set the auth back to "on". Still no dice. Here's the error message that was logged:

Oct 21 19:11:44 host=smtp.bizmail.yahoo.com tls=on auth=on user=rob@creacontech.com from=rob@creacontech.com recipients=creacontech@windstream.net errormsg='TLS handshake failed: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol' exitcode=EX_IOERR


I'm going to be away all day tomorrow, but I'll check my email as soon as I get home tomorrow evening. Thanks for all your help so far. I sure hope we can fix this thing.

BTW, I also have a Yahoo mail account in my Outlook. It uses port 25, and I can successfully send mail from it, as well as receive.

Re: Suddenly I can't send email

PostPosted: 22. October 2009 03:29
by Izzy
BTW port 587 is the alternative port for port 25 if your ISP blocks port 25 and is not for secure TLS connections and will give an error - see below.


creacon wrote:BTW, I also have a Yahoo mail account in my Outlook. It uses port 25, and I can successfully send mail from it, as well as receive.
Do you mean Outlook or Outlook Express and this could possibly mean that you are not using Transport Layer Security (TLS - encrypted email) with Outlook - if your SMTP/POP server has Transport Layer Security email then IMHO you should use it as the equivalents in snail-mail are sending your letter into an envelope -TLS, or using a post card - plain email.
Yahoo wrote:We strongly recommend that you enable SSL for both POP and SMTP, as detailed in the above instructions. This will ensure that your Yahoo! ID, password and email messages are transmitted securely between your mail client and the Yahoo! servers. However, if you choose to not use SSL for SMTP, your email client will likely default the SMTP port to 25.
http://help.yahoo.com/l/us/yahoo/smallbusiness/bizmail/pop/pop-33.html



The configuration for sendmail not using TLS:
Code: Select all
account PlainYahooMail
host smtp.bizmail.yahoo.com
from rob@creacontech.com
auth on
port 25
user rob@creacontech.com
password [is your secret only]


The configuration for sendmail using TLS:
Code: Select all
account SecureYahooMail
host smtp.bizmail.yahoo.com
from rob@creacontech.com
port 465
auth on
user rob@creacontech.com
password [is your secret only]
tls on
tls_starttls off
tls_certcheck off



BTW Accepted methods for auth are 'on', ‘plain’, ‘cram-md5’, ‘digest-md5’, ‘gssapi’, ‘external’, ‘login’, and ‘ntlm’.

Here is the full documentation for the msmtp (sendmail in XAMPP 1.7.2):
http://msmtp.sourceforge.net/doc/msmtp.html

Good luck.