Forum Moderators: coopster

Message Too Old, No Replies

How to send mail from php script on localhost

         

TravelSite

1:20 am on Aug 7, 2005 (gmt 0)

10+ Year Member



I downloaded xampp in order to run php on my pc/localhost. I've got php scripts running ok now - but I'm having problems getting emails to send using the mail() php function.

Can anyone suggest what to do in order for me to be able to send emails via a php script? Thanks

ergophobe

1:37 am on Aug 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You'll need to have a mail server up and running and XAMPP does not include one.

I've never tried to send mail from XP, but I would imagine that XP Pro has a mail server built in somewhere... not sure really.

TravelSite

1:50 am on Aug 7, 2005 (gmt 0)

10+ Year Member



thanks ergophobe

- It has something called "Mercury Mail" - is this something I can use?

dhardisty

12:32 pm on Aug 7, 2005 (gmt 0)

10+ Year Member



PostCast server is free and runs on windows. [postcastserver.com...]

You'll have to configure it and php correctly, but you can indeed send emails out from your home computer.

jatar_k

3:05 pm on Aug 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



for a local setup on windows I have always just used my ISP's SMTP server

TravelSite

3:54 pm on Aug 7, 2005 (gmt 0)

10+ Year Member



Most of this is beyond me!

I've been introduced to the following files during the past two days - sendmail.ini, php.ini (Xampp has three of them!), Mercury Mails own program (C:\apachefriends\xampp\MercuryMail\mercury.exe), Xampps own web based send mail interface. I've set up a new account on outlook express and tried turning off firewall/antivirus to see if it made a difference.

From within Mecury Mails own program I can now send external mails - but not when calling mail() from within php (which is what I need). Documentation for setting up Mecury Mail seems non-existant! I've always taken the mail() function for granted up untill now :)

jatar_k,

What do I need to do in order to use my ISP's SMTP server so that I can use mail() in php? Does it involve changing settings in sendmail.ini and php.ini?

dhardisty,
I will try postcastserver if I can't get this to work - but a lot of people on their forums also seem to have issues with getting mail() to work.

jatar_k

4:00 pm on Aug 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I just alter the php.ini to point to the same servers that I type in when configuring my email client, couldn't be easier

TravelSite

5:54 pm on Aug 7, 2005 (gmt 0)

10+ Year Member



jatar_k,

Many thanks! Its working now for one of my email accounts.

I updated the following lines:


; For Win32 only.
SMTP = mail.FOO.net
; For Win32 only.
sendmail_from = FOO@BAR.co.uk

...and sending emails using mail() now works perfectly :)

I also tried it on another account which didn't work (though I can make do without it) - it had "My Server Requires Authentation" ticked for outgoing mail - would this be the reason it wouldn't work for this other account? If so would there be any way around this?

Many thanks everyone :)

jatar_k

6:10 pm on Aug 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



probably, I have never tried one with auth on