sendmail newbie question
Moderator: General Moderators
-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm
sendmail newbie question
i finally installed php support for my apache server with help from http://www.thesitewizard.com/
now im trying to write his code for a sendmail form but having issues
i have 2 files one is index.php
the second is sendmail.php
the code i have for index. php is
<html>
<title>Hello</title>
<body>
<form method="post" action="sendmail.php">
Email: <input name="email" type="text" /><br />
Message:<br />
<textarea name="message" rows="15" cols="40">
</textarea><br />
<input type="submit" />
</form>
</body>
</html>
the code for sendmail.php is
<?
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "littlebill@littlebill.shacknet.nu", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.yahoo.com" );
?>
this is the error i get
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in c:\documents and settings\littlebill\desktop\webpage\sendmail.php on line 6
Warning: Cannot modify header information - headers already sent by (output started at c:\documents and settings\littlebill\desktop\webpage\sendmail.php:6) in c:\documents and settings\littlebill\desktop\webpage\sendmail.php on line 7
this is what i have load in the php.ini on the apache server
[mail function]
; For Win32 only.
SMTP = smtp.littlebill.shacknet.nu
smtp_port = 25
; For Win32 only.
;sendmail_from = LittleBill@littlebill.shacknet.nu
this is apache on a xp computer
now am i have a syntax error or is this a mail server issue, as my users have to authenticate to send, the mail server is not an open relay, but i switched it to open relay with no luck, any help would be greatly appreicated
you can find the above program at
http://littlebill.shacknet.nu:81/index.php
again i would really appreciate it
now im trying to write his code for a sendmail form but having issues
i have 2 files one is index.php
the second is sendmail.php
the code i have for index. php is
<html>
<title>Hello</title>
<body>
<form method="post" action="sendmail.php">
Email: <input name="email" type="text" /><br />
Message:<br />
<textarea name="message" rows="15" cols="40">
</textarea><br />
<input type="submit" />
</form>
</body>
</html>
the code for sendmail.php is
<?
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "littlebill@littlebill.shacknet.nu", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.yahoo.com" );
?>
this is the error i get
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in c:\documents and settings\littlebill\desktop\webpage\sendmail.php on line 6
Warning: Cannot modify header information - headers already sent by (output started at c:\documents and settings\littlebill\desktop\webpage\sendmail.php:6) in c:\documents and settings\littlebill\desktop\webpage\sendmail.php on line 7
this is what i have load in the php.ini on the apache server
[mail function]
; For Win32 only.
SMTP = smtp.littlebill.shacknet.nu
smtp_port = 25
; For Win32 only.
;sendmail_from = LittleBill@littlebill.shacknet.nu
this is apache on a xp computer
now am i have a syntax error or is this a mail server issue, as my users have to authenticate to send, the mail server is not an open relay, but i switched it to open relay with no luck, any help would be greatly appreicated
you can find the above program at
http://littlebill.shacknet.nu:81/index.php
again i would really appreciate it
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
your header warning can be fixed by reading through and following the tutorial: Warning: cannot add header information
as for everything else, I'm not sure.
as for everything else, I'm not sure.
-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm
-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm
i have fixed the problem by adding
ini_set('sendmail_from', 'littlebill@littlebill.shacknet.nu');
before my mail command
<?
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
ini_set('sendmail_from', 'littlebill@littlebill.shacknet.nu');
mail( "littlebill@littlebill.shacknet.nu", "Feedback Form Results",
$message, "From: $email" );
?>
it was said this was need for a windows version of php which i am running with apache, it was also said i could add this in my php.ini file, could someone tell me where exactly i could add that so i don't have to keep adding that init line in all my coding
ini_set('sendmail_from', 'littlebill@littlebill.shacknet.nu');
before my mail command
<?
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
ini_set('sendmail_from', 'littlebill@littlebill.shacknet.nu');
mail( "littlebill@littlebill.shacknet.nu", "Feedback Form Results",
$message, "From: $email" );
?>
it was said this was need for a windows version of php which i am running with apache, it was also said i could add this in my php.ini file, could someone tell me where exactly i could add that so i don't have to keep adding that init line in all my coding
-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
i dunno anything bout headers but when i get a header error i put (u gotta put this as THE FIST THING no matter what in the code, the 1st line.)
їcode]
ob_start();
ї/code]
this has fixed evey header error iver ever gotten although ppl are going to look at it and be like that kid sux but use it any it will work, remember before the <html> before the css it has to be the 1st line in the file no matter what.
їcode]
ob_start();
ї/code]
this has fixed evey header error iver ever gotten although ppl are going to look at it and be like that kid sux but use it any it will work, remember before the <html> before the css it has to be the 1st line in the file no matter what.
-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm
lol, im kinda of losing it i tried a ton of different searches and still don't know what the hell im looking for
let me ask a couple newbiew questions one is what the hell does the header do?
also after they submit the form how do i get them to another page instead of it just going blank after the submit
let me ask a couple newbiew questions one is what the hell does the header do?
also after they submit the form how do i get them to another page instead of it just going blank after the submit
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
http://php.net/header
the header is textual data sent to the browser that it doesn't normally show you. It's used for cookies, and other agent settings and server information. If a header call happens after content has started streaming out, the headers have already been sent, and therefore the header call will do nothing.
header() is used most often to redirect the client to a new location.
the header is textual data sent to the browser that it doesn't normally show you. It's used for cookies, and other agent settings and server information. If a header call happens after content has started streaming out, the headers have already been sent, and therefore the header call will do nothing.
header() is used most often to redirect the client to a new location.