SMTP for the Mail fucntion in PHP

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

SMTP for the Mail fucntion in PHP

Postby adaykin » 30. August 2007 00:27

Hello, I am trying to use the Mail function in PHP, but I am not sure how to set up either the PHP.ini file or the SMTP.ini file to do so. I tried using the function but I ran into this error message:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\xampp\eclipsePHP\formSubmit.php on line 52
adaykin
 
Posts: 8
Joined: 08. July 2007 04:38

Postby Izzy » 30. August 2007 04:22

In the xampp\apache\bin\php.ini find near line 693:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

Change to:

[mail function]
; For Win32 only.
SMTP = smtp.myispmailserver.com
(your ISP's smtp mail server - the one you use in your email client eg. Outlook Express etc.)
smtp_port = 25 (the port you use for sending mail via your ISP as above)

SMTP.ini ? - no such file in XAMPP

If you select sendmail in your script then you would set up Sendmail in XAMPP:
xampp\sendmail\sendmail.ini
in much the same way as above.

Localhost is used usually if you have a mail server set up on your PC to send/receive mail via localhost, which most ISPs don't allow these days, and most receiving Mail Exchanges block without a dedicated IP/Domain name combo.

So best sticking with either the php.ini or the Sendmail method above, much simpler and does the trick for most php scripts.
HTH

=================================================
Take a look at the new DeskTopXampp launch control posted by ridgewood:
http://community.apachefriends.org/f/viewtopi ... 967#103967

The DeskTopXampp launch control for XAMPP and XAMPPlite (DTX.exe)
is available here:
http://zedfiles.com/DTX/

I highly recommend DTX.
=================================================
Last edited by Izzy on 02. September 2007 01:47, edited 2 times in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby lyntuan » 01. September 2007 14:56

PHP mail function only works with smtp mail server, but not works with smtp auth mail server as GMail or Yahoo (POP before smtp)
Last edited by lyntuan on 26. December 2008 13:50, edited 1 time in total.
AMPstart :: Launch a Portable Web Server
http://ampstart.com
----------------------------------------------------------
Please read Disclaimer section carefully before downloading
lyntuan
 
Posts: 104
Joined: 08. November 2006 00:21

Postby crayons » 06. September 2007 18:19

just curious. what does desktop xampp do?
crayons
 
Posts: 1
Joined: 06. September 2007 18:14

Postby Izzy » 07. September 2007 02:14

crayons wrote:just curious. what does desktop xampp do?


http://nat32.com/dtx/

The DTX Launcher lets you start Apache and MySql from any USB storage device.
It requires no configuration, although some customization can be done by editing a simple ini file.

=================================================
Take a look at the new DeskTopXampp launch control for XAMPP and XAMPPlite (DTX.exe)
http://nat32.com/dtx/
posted by ridgewood:
http://community.apachefriends.org/f/viewtopi ... 967#103967
Also available here: http://zedfiles.com/DTX/
I highly recommend DTX.
=================================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Warning: mail() [function.mail]: SMTP server response: 551

Postby mikesz » 18. September 2007 17:26

Warning: mail() [function.mail]: SMTP server response: 551 User not local; please try <forward-path> in C:\xampp\htdocs\testmail.php on line 11

Hello, I am wondering is anyone has a clue what this source of this problem is?

I am trying to get php mail() to work with xampp that I just installed. I have used the form to send email via mercurymail and it works perfectly but any attempt to try to use php mail directly in a script produces this error message and of course fails to send the message.

My test script is a no brainer actually:

$mailtos = "webmaster@mydomain.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "postmaster@mydomain.com";
$header = "From: $from";
if (mail($mailtos, $subject, $message, $header)) {
echo "<i>mail-sendok</i>";
} else {
echo "<i>mail-sendnotok</i>";
}

I have used every reference I can think of to point the smtp in php.ini to my ISP server and nothing works? It did work correctly when I had Apache2Triad installed but xampp seems to have a problem with it.

Here is the php.ini piece, fyi:

[mail function]
; For Win32 only.
SMTP = mail.mydomain.com
smtp_port = 25


; For Win32 only.
sendmail_from = webmaster@mydomain.com


Any light at all will be greatly appreciated, kindest regards, mikesz
mikesz
 
Posts: 2
Joined: 18. September 2007 17:15


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 75 guests