Current location: Hot Scripts Forums » Programming Languages » PHP » a question concerning mail function in php?


a question concerning mail function in php?

Reply
  #1 (permalink)  
Old 05-28-05, 04:28 PM
timorthy timorthy is offline
Newbie Coder
 
Join Date: May 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Question a question concerning mail function in php?

Hi all,

I'm doing a contact page in php and facing a problem when using mail function. As I test the page, it appears a warning following:

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\success.php on line 1.


How should I handle the error?. Many thanks.

Last edited by timorthy; 05-28-05 at 04:31 PM.
Reply With Quote
  #2 (permalink)  
Old 05-28-05, 04:51 PM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Just add the From: header in the headers or tune your php.ini/.htaccess/use ini_set() to set the sender of the message (like noreply@yoursite.com)
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Reply With Quote
  #3 (permalink)  
Old 05-29-05, 04:05 AM
timorthy timorthy is offline
Newbie Coder
 
Join Date: May 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Question

Please help me figure out this error

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\contact.php on line 2

What is the problem in here?

Many thanks.
Reply With Quote
  #4 (permalink)  
Old 05-29-05, 08:02 AM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
you need to stripslashes() the message!
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #5 (permalink)  
Old 05-29-05, 04:34 PM
timorthy timorthy is offline
Newbie Coder
 
Join Date: May 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Question

ok, here is my short code test

<?php
$name = 'James';
$email = 'james@yahoo.com';
$feedback = 'Here is feedback of the sender...';
$toaddress = 'Smith4343@yahoo.com';
$subject = 'Feedback from reader';
$mailcontent = 'Customer name: '.$name."\n"
.'Customer email: '.$email."\n"
."Customer comments: \n".$feedback."\n";
$fromaddress = 'From: webserver@company.com';
mail($toaddress, $subject, $mailcontent, $fromaddress);

?>

<HTML>
<head> <title>Test Contact Page</title>
</head>
<body>
Feedback submitted;
</body>
</HTML>



The error appears here is

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\contact.php on line 2



Please check it and help me out.
Reply With Quote
  #6 (permalink)  
Old 05-29-05, 05:32 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
it doesnt recognise the html tags, you need to add headers in order to send html emails! http://www.zend.com/zend/trick/html-email.php#head3
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #7 (permalink)  
Old 05-29-05, 07:02 PM
Jaffizzle Jaffizzle is offline
Newbie Coder
 
Join Date: May 2005
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
set_magic_quotes_runtime(0);

Try that at the top of your code
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i work with PHP mail() function darkcarnival PHP 5 08-31-09 05:11 PM
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 10:17 AM
PHP Error Fairnie PHP 8 06-26-04 07:15 AM
accessing existing ISP email with a PHP webmail script. nlancaster PHP 1 01-07-04 03:28 AM
Help trim code down TheLaughingBandit JavaScript 0 09-02-03 09:50 AM


All times are GMT -5. The time now is 06:48 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.