xampp can't send mail in my local

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

xampp can't send mail in my local

Postby onikage997 » 03. March 2011 11:33

hi all,

It seems that I can't send a test mail in my local host to test my code
Code: Select all
$from="From:xxxxxx@xxxxxx.com"; 
$contents="this is a test"; 
$subject="hello"; 
$to = "xxx@xxx.com"; 
$sent = mail($to, $subject, $contents, $from);


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


can someone help me so that I can send email in my local?

Many Thanks
onikage997
 
Posts: 1
Joined: 03. March 2011 11:27

Re: xampp can't send mail in my local

Postby glitzi85 » 04. March 2011 20:44

Hi,

Windows does not have an Mailserver onboard. You must either run the Mercury Mailserver (not included in XAMPP Lite), define an usable mailserver in the php.ini (usable means no Authentication necessary for sending mail) or use the included sendmail to relay mail via an mailserver which requires authentication.

I assume you are using XAMPP as an testing environment and the mail should be only for testing. Also i assume you do not operate an mailserver (otherwise you would not ask that question). So the simplest solution would be to use the sendmail and let it connect to the mailserver of your E-Mail provider. In the sendmail folder you will find the file sendmail.ini. Open it and take the Hotmail example, change the values to the appropriate values of your E-Mail provider and set account default to Hotmail. In the php.ini comment out smtp and smtp_port, set sendmail_from to your E-Mail Address and uncomment sendmail_path. Then restart Apache and it should work.

In the php.ini it should look like this:

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 = youremail@example.com

; 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"


glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 100 guests