Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 25th, 2004, 04:38 PM
Authorized User
 
Join Date: Aug 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Tachyon
Default trouble with Email and PHP

My PHP programs won't send Email messages out. When I try, I get this error message:

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\gears\work\simple_mailer.php on line 135

I have this in my php.ini file:

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

; For Win32 only.
;sendmail_from = [email protected]

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


Can anyone please offer suggestions?

__________________
An overworked Web Developer who\'s expected to know everything yet given time to study nothing.
 
Old May 25th, 2004, 04:49 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Try uncommenting the sendmail_from line.

Snib

<><
 
Old May 25th, 2004, 09:34 PM
Authorized User
 
Join Date: Aug 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Tachyon
Default

Thanks. That took me to another error message but I fixed it by changing
[mail function]
; For Win32 only.
SMTP = localhost

to
[mail function]
; For Win32 only.
SMTP = mail.domainname.net


I don't know how that solved the problem but it did. I guess the Apache 2 Web server I have running on my computer isn't configured to handle Email.

 
Old May 26th, 2004, 03:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Apache doesn't actually have anything to do with the mail. You need some sort of mail transfer agent to send the mail (something like sendmail or, my preference, postfix). mail(); simply generates a mail message but sends it through to the MTA, exiting on success with "true". It's up the how the MTA is configured, to take that input and turn it into an actual mail message.

Windows machines don't have an mail transfer agent on them, usually - unless you pay major money for one of Microsoft's "Super Dooper Server" versions, or something.Sending the job to localhost won't work, because on Windows there's usually nothing on localhost to do the job. So, if you are running on Windows, you need some third party machine to do the actual mail sending (not necessarily a Unix machine, although that'd be much cheaper, etc. - an Exchange Server machine will be just as good, from the point of view of sending the actual message - but either way, your own machine needs relay mail rights on that machine, so it's not something to embark about configuring lightly).

A Unix webhost, however, can have a variety of MTAs installed on it for free (this includes Mas OS X, of course). They will now be running locally, so you can refer the job to localhost, and PHP will send the job through to whatever mail transfer agent exists on localhost for execution.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble connecting MySQL to PHP nofences84 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 June 14th, 2007 11:21 PM
email php sunsetbay Beginning PHP 7 July 16th, 2005 01:57 PM
Email In php 4 philuk86 Beginning PHP 19 July 14th, 2004 05:31 PM
createmovie.php logon trouble JohnAlden BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 May 25th, 2004 01:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.