Having trouble setting up

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Having trouble setting up

Postby consh » 03. January 2010 20:37

Hello,

I hope someone can help. For 3 days now i have been trying to setup my pc to be able to test php contact forms and send emails from the script. I'm using windows xp pro. I've actually uninstalled xampp and reinstalled it a few times as i've changed so many settings.
I'm running XAMPP 1.7.3 now. I've gone into php.ini and changed SMTP = to my correct smtp name. The port is correctly set to 25. I've changed sendmail-from to the correct address and i've attempted to configure sendmail.ini.
When i've made all these changes and i attempt to use the test contact form the error i get is as follows:

Warning: mail() [function.mail]: SMTP server response: 553 This SMTP server requires authorisation. Most mail clients can be configured with "my server requires authorisation" to allow this in C:\xampp\htdocs\sendmail.php on line 4


I've tried various suggested methods of getting round this as found on the web but none seem to work.
Now, if i uncomment the sendmail_path section in the unix only section i don't get the error mentioned above. however i don't receive the email.
Could somebody please advise me on where i'm going wrong.

Many thanks in advance from one stressed cookie
consh
 
Posts: 8
Joined: 03. January 2010 20:23

Re: Having trouble setting up

Postby Nobbie » 03. January 2010 22:35

You cannot use PHP's mail()-Function if your SMTP server requires authorization (mail() does not support authorization).

You should use a phpmailer class instead, see http://phpmailer.worxware.com/
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: Having trouble setting up

Postby Izzy » 03. January 2010 23:43

If you still want to use the XAMPP mail facilities then you deed to configure the php.ini file and the sendmail.ini file to facilitate authentication.

This post has most of what you need even though the OP did not eventually get it to send mail, but that may have been an issue with his script and not with the configurations:
viewtopic.php?f=16&t=38648&p=154326

Let me know back if there is anything in the above link that you are concerned about.

These Forum Search Results have more on sendmail used in XAMPP.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Having trouble setting up

Postby consh » 04. January 2010 21:51

Thank you for you prompt replies.
Izzy, i read carefully through the thread that you put me on to and have followed your instructions however i still am not set up yet. Would you be so kind as to read through my configurations and let me know if you can spot anything. I'd actually read through most of the similar threads before posting my problem but to no avail.
please note i have blocked out certain sensitive information.

php.ini
Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = localhost
; http://php.net/smtp-port
;smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
mail.log = "C:\xampp\apache\logs\php_mail.log"


When trying to configure php.ini previously, i uncommented the 'smtp =' & 'sendmail-from' lines and added my details as that's what i'd learnt from another forum. However now i have stuck to the instructions you gave to other member.

sendmail.ini
Code: Select all
# Example for a user configuration file

# Set default values for all following accounts.
defaults
logfile "C:\xampp\sendmail\sendmail.log"

# Mercury
account Mercury
host localhost
from postmaster@localhost
auth off

# A freemail service example
account Home
tls on
tls_starttls off
tls_certcheck off
host ####.#####.co.uk
from ####@####.co.uk
auth on
port 25
user ##########
password ##########

# Set a default account
account default : Home


Before i added 'tls_starttls off' i was getting the following error message in sendmail log:
Code: Select all
Jan 04 20:24:05 host=#####.#####.co.uk tls=on auth=on user=####@#####.co.uk from=####@#####.co.uk recipients=####@#####.co.uk errormsg='the server does not support TLS via the STARTTLS command' exitcode=EX_UNAVAILABLE

After i added 'tls_starttls off' i had the following message come up in sendmail log:
Code: Select all
Jan 04 20:26:52 host=#####.#####.co.uk tls=on auth=on user=####@#####.co.uk from=####@#####.co.uk recipients=####@#####.co.uk errormsg='TLS handshake failed: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol' exitcode=EX_IOERR

Sorry if this message is a bit longwinded. I just wanted to give you as much info as i could. The script i've been testing was copied from Wc3 website .

I appreciate you taking the time to read this message

Thanks
consh
 
Posts: 8
Joined: 03. January 2010 20:23

Re: Having trouble setting up

Postby Izzy » 05. January 2010 00:32

Perhaps your .co.uk email host does not permit TLS/SSL on port 25 but may on port 465, so change the port and try again and/or check with your email host what port they use to connect via TLS/SSL - the default is port 465.

If your host does not support TLS/SSL at all then you would have to comment out the tls entries and revert to port 25 then try your script again.

You other settings seem to be fine.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Having trouble setting up

Postby consh » 05. January 2010 22:36

Thanks for persisting with me Izzy.
I've tried commenting out the tls lines and reverting back to port 25 but am still not receiving any emails.
I've contacted my isp 3 times now and have been told a different port each time for tls/ssl so that's why i reverted back to port 25. I hold a hotmail account. seeing as i'm having no joy with my isp's smtp procedure is it simple enough to direct the emails through my hotmail account.

Once again thank you for your advice. It's much appreciated. I've seen how many times you've posted on this subject and i have to say you have the patient of a saint. I have read through every single posting on the link you posted and tried so many different variations getting to this point. I just feel it's something so simple. :?
consh
 
Posts: 8
Joined: 03. January 2010 20:23

Re: Having trouble setting up

Postby consh » 05. January 2010 23:38

Hi again,

I just wanted to add that i haven't had any messages log in the sendmail log since making the chabges that you recently suggested. I'm not sure if my message has been sent and is floating around in cyber space somewhere :?
consh
 
Posts: 8
Joined: 03. January 2010 20:23

Re: Having trouble setting up

Postby Wiedmann » 05. January 2010 23:54

seeing as i'm having no joy with my isp's smtp

Which program do you use in a normal way in order to send a mail over the ISP SMTP?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Having trouble setting up

Postby consh » 06. January 2010 07:59

Hi Wiedmann,

I use MS Outlook 2003

Thanks for reading
consh
 
Posts: 8
Joined: 03. January 2010 20:23

Re: Having trouble setting up

Postby Wiedmann » 06. January 2010 11:51

I use MS Outlook 2003

OK, you must configure msmtp (sendmail) exactly like Outlook. First you must have following infos from your Outlook:

Go to:
Tools --> E-mail Accounts --> change existing e-mail account (select the correct one, if you have more then one)

From the main dialog you need following infos:
- E-mail Address
- Outgoing mail server
- User Name
- Password

The you must click on "More Settings".
- What is selected at "Outgoing Server"?
(requires auth, same settings as incoming server or different settings)

At "Advanced" you must look for:
- Outgoing server (the port number)
- requires SSl is checked or not?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Having trouble setting up

Postby consh » 06. January 2010 14:10

Hi Wiedmann

What is selected at "Outgoing Server"?


I have 'My outgoing server(SMTP) requires authentication' selected.
I also have 'Use same settings as my incoming mail server' selected

Outgoing server (the port number)
- requires SSl is checked or not?


The port number is 25 and 'requires SSL' isn't checked.

Thank you for helping me.
consh
 
Posts: 8
Joined: 03. January 2010 20:23

Re: Having trouble setting up

Postby Wiedmann » 06. January 2010 15:27

php.ini

First you should revert your "php.ini" to the default state. Only enable the line (remove the semicolon) with sendmail_path. So this part of the "php.ini" should looks like:
Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"


sendmail.ini

Your "sendmail.ini" should be something like:
Code: Select all
# Example for a user configuration file

# Set default values for all following accounts.
defaults
logfile "C:\xampp\sendmail\sendmail.log"

# Mercury
account Mercury
host localhost
from postmaster@localhost
auth off

# A freemail service example
account Home
host Outgoing_mail_server_from_outlook
from E-mail_Address_from_outlook
auth on
user User_Name_from_outlook
password Password_outlook

# Set a default account
account default : Home



Now delete the file "C:\xampp\sendmail\sendmail.log" if its exists and restart Apache. Put this "mailtest.php" in "C:\xampp\htdocs":
Code: Select all
<?php
error_reporting
(E_ALL);
var_dump(mail('E-mail_Address_from_outlook', 'testmail', 'This is a testmail.'));
?>


Access this file in your browser with http://localhost/mailtest.php.
- what's the output in your browser?
- what can you read in "C:\xampp\sendmail\sendmail.log"?
- (after a delay) can you see this new mail in Outlook (maybe also check the spam folder)?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Having trouble setting up

Postby consh » 07. January 2010 10:02

Hi Wiedmann

I've followed your instructions and the results are as follows. Please note i've hidden certain details.
what's the output in your browser

bool(true)

what can you read in "C:\xampp\sendmail\sendmail.log"?


Jan 07 08:21:46 host=####.######.co.uk tls=off auth=on user=####@######e.co.uk from=####@######.co.uk recipients=E-mail_Address_from_outlook errormsg='cannot use a secure authentication method' exitcode=EX_UNAVAILABLE

(after a delay) can you see this new mail in Outlook (maybe also check the spam folder)?


After waiting 30 mins there is still no email, however i will keep checking throughout the day.
I'm thinking though by the looks of the error code it may not come.
consh
 
Posts: 8
Joined: 03. January 2010 20:23

Re: Having trouble setting up

Postby Wiedmann » 07. January 2010 12:24

Jan 07 08:21:46 host=####.######.co.uk tls=off auth=on user=####@######e.co.uk from=####@######.co.uk recipients=E-mail_Address_from_outlook errormsg='cannot use a secure authentication method' exitcode=EX_UNAVAILABLE

change:
Code: Select all
auth on

to:
Code: Select all
auth plain

and try again.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Having trouble setting up

Postby consh » 07. January 2010 14:07

Problem solved!!! :D
Thank you very much for taking the time out to help me.
I received a strange email when loading the mail test script you showed me but i've since tried other scripts and they all work fine.

Once again thanks to you Wiedmann and also to Izzy. Your paitence is very much appreciated.
If the forum supports such a feature, i will be making a donation

Thak you thank you thank you
consh
 
Posts: 8
Joined: 03. January 2010 20:23

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 64 guests