PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 16th, 2002, 06:45 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 599 DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 14 h 5 m 6 sec
Reputation Power: 40
Quicky - mail() function

I've written the following code to test the mail function on my system...
PHP Code:
<?php
    
function send_mail() {
        
mail ('c.miles@cqu.edu.au''Sup''Like I said, Sup');
    }
    if (@
$HTTP_POST_VARS['action'] == 'submitted') {
        
send_mail();
    }
?>
Send E-mail? 
<form action="<?php echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="form_Search" target="_self">
<input type="hidden" name="action" value="submitted">
<input type="submit" name="Submit" value="Submit">
</form>


... and I get the following error ...

Quote:
Warning: Server Error in d:\inetpub\wwwroot\phptest\test3.php on line 10


Does my server need to be configured to use this function? The PHP documentation gave me the impression that this function should work out of the box.

Reply With Quote
  #2  
Old September 16th, 2002, 07:14 PM
neurality neurality is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 0 neurality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This is a stupid question, but is your computer which the script is running off of running a mail server? Because if not, I believe you need to change your configuration so that the SMTP (Windows) or sendmail_path (UNIX) variable points to the correct address of the mailserver.

Of course, if you've done that already forget everything I just said.

Reply With Quote
  #3  
Old September 16th, 2002, 07:15 PM
maytricks's Avatar
maytricks maytricks is offline
Always Spell Chek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: NJ, USA
Posts: 338 maytricks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 27 sec
Reputation Power: 7
This may be it.

PHP Code:
<form action="<? $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="form_Search"


also maybe

PHP Code:
 $to "c.miles@cqu.edu.au";
$from "yourmail@yourdomain.com";
$from_name "Your Name";
$subject "Sup";
$message "Like I said, Sup"
mail($to,$subject,$message,"From: \"$from_name\" <$from>"); 
__________________
Programming is easy. It's the thinking that's hard.

Search the forums before you ask your question.
PHP | MySQL websites. Visit them, read them, cherish them.
Read the posting rules, before you post.
See if your question has been answered already.

Reply With Quote
  #4  
Old September 16th, 2002, 07:32 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 599 DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 14 h 5 m 6 sec
Reputation Power: 40
Looks like I was asking the stupid question. My machine isn't running a mail server. Can you give me any pointers for where to configure SMPT to point to my mail server? I'm running XP. I've looked in the SMPT properties but I don't see a place to specifically define an address for a mail server.

Thanks

Reply With Quote
  #5  
Old September 16th, 2002, 07:37 PM
maytricks's Avatar
maytricks maytricks is offline
Always Spell Chek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: NJ, USA
Posts: 338 maytricks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 27 sec
Reputation Power: 7
In your PHP.ini file

Quote:
[mail function]
; For Win32 only.
SMTP = smtp.yourserver.com ; for Win32 only

; For Win32 only.
sendmail_from = mail@yourserver.com; for Win32 only

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

Reply With Quote
  #6  
Old September 16th, 2002, 07:48 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 599 DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 14 h 5 m 6 sec
Reputation Power: 40
Thanks Maytricks. That's fixed my problem.

Cheers

Reply With Quote
  #7  
Old September 16th, 2002, 08:33 PM
Epsilon Epsilon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Long Beach, California
Posts: 86 Epsilon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 10 m 48 sec
Reputation Power: 8
You can also get rid of the action= thingy if your going to be submitting it to the same script.

i.e.

<form method="post" enctype="multipart/form-data" name="form_Search">

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Quicky - mail() function


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT