Jump to content
The Uniform Server Community
Sign in to follow this  
kalpz

PHP mail();

Recommended Posts

Hi.. I have read in other posts that a local mail server is required in order for PHP to send e-mails. Is it possible to use an external mail server.

 

I use my ISP's email address, is it possible to go through my ISP's mail server??

 

Thanks

Kalpesh

Share this post


Link to post
Share on other sites

You can indeed use your ISP's email address. Open the file php.ini located in folder:

 

\Uniform Server\diskw\usr\local\php

 

About halfway down this file locate the section named [mail function] you will find three settings: SMTP, sendmail_from, and sendmail_path.

 

 

[mail function]

; For Win32 only.

SMTP = localhost

smtp_port = 25

 

; For Win32 only.

sendmail_from = me@localhost.com

 

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").

;sendmail_path = "W:\plugins\SendMail\sendmail.exe -t"

 

 

1) Replace localhost with your ISP's SMTP server.

(The one you use to set-up Outlook Express)

 

2) sendmail_from = your email address, or an address you would like to appear as the default 'from' address for emails sent from PHP scripts

 

3) sendmail_path: Not used in Window leave as is.

 

Thats it :D

Share this post


Link to post
Share on other sites

Thanks for your reply. I have this..

 

 

[mail function]

; For Win32 only.

SMTP = smtp.xtra.co.nz

smtp_port = 25

 

; For Win32 only.

sendmail_from = kalpz@xtra.co.nz

 

And I get this...

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.xtra.co.nz" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in W:\www\mail.php on line 2

 

Any ideas?

Share this post


Link to post
Share on other sites

What you have set-up looks correct.

 

The error message you receive can be produced for a number of reasons.

 

1) You need to be connected to the Internet before running your PHP program.

2) If your host requires authentication for outgoing mail you cannot use the PHP mail function it does not support it.

3) Your service provider may be using an alternative port and not 25 (unlikely) Note: Check what you use in Outlook Express to confirm 2) and 3)

4) I assume you can send and receive emails (to this account) that rules out router, firewall and AntiVirus software problems.

 

I think that covers most causes you would be surprised 1) is the prime candidate especially when testing.

Share this post


Link to post
Share on other sites

1) Im on broadband, on 24/7

2) Not authentication on outgoing mail.

3) I use outlook, outgoing port is 25.

4) Yes.

Share this post


Link to post
Share on other sites

Dont worry i've fixed it.

 

My McAfee was blocking the port 25. :|

 

Thanks anyways

Share this post


Link to post
Share on other sites

Dont worry i've fixed it.

 

My McAfee was blocking the port 25. :|

 

Thanks anyways

 

It looks as if I jumped the gun when I dismissed the potential cause in 4)

 

Anyway glad you fixed it, more importantly thanks for the post and letting others know your solution to the problem.

 

:rolleyes:

Share this post


Link to post
Share on other sites

Your welcome..

 

Yeah I disabled everything and turned everything back on 1 by 1 and it turned out it was my antivirus :|. Oh well..

 

Thanks again..

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...