I have been working through an "Introduction to PHP" book that has been very useful but i'm stuck on the mail() function. The syntax looks pretty simple but when i actually try and run the code on my pc and try to send an email to my hotmail account i get the following 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 D:\Web\WebServer\Apache2\htdocs\WROX\chapter11\firstmail.php on line 2

The settings in php.ini are

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

; For Win32 only.
sendmail_from = me@example.com

which was defaulted in.

My specific questions are:
* What should these settings be to allow me to send outgoing emails? (I don't need to to receive anything, just make sure i'm happy with the basic functions).
* Is the sendmail_from field open to abuse as it could be set to anything? - i.e i could pose as someone else.
* Do i need to install any extra software (a mailserver) or can i configure Apache for this?

In short, what steps do i need to take to send emails from my PC to hotmail?

Any advice/help would be greatly appreciated.

btw,
OS is XP and i'm running Apache 2.0

Thanks,
Peter

Recommended Answers

All 3 Replies

Options:

1. Install Sendmail or a similar SMTP server
or
2. Use the SMTP settings from your email account. (so PHP will connect to your outgoing mail server just like your email programs do)

Member Avatar

i posted this send mail before search it here..
works withing and without smtp server

i am having the same EXACT problem and cant get an answer anywhere....if you got an answer email it to me please at [email]berns99999@gmail.com...than[/email]king you in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.