Problem of PHP mail function

Asked By 230 points N/A Posted on -
qa-featured

 

Hello, to all members of techyv.com. I’m Kamerun. I am very eager to learn web development. I learned html & php from w3schools.com. The feedback tab, I was created by PHP on my portfolio site by PHP mail function, which I collect from w3schools. But unfortunately, it does not work. I m sure, I create this absolutely Correct>below this code: 

————————————-

Code r show below…………

—————————————-

 

<html>
<body>
 
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail("[email protected]", "$subject",
  $message, "From:" . $email);
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>
 
</body>
</html> 
 
Please help me:
 
N.B. My Domain & Hosting both r free.
  1. domain: co.cc
  2. hosting: byethost.com
SHARE
Best Answer by derrick andrews
Best Answer
Best Answer
Answered By 0 points N/A #107738

Problem of PHP mail function

qa-featured

The php’s mail function is an easy way of sending email from a form. The code given by you have some problem. I have edited the code given by you, you can try it. A usually free hosting service provider does not provide the mail service. So please make sure that whether the free hosting account you are having has the mail function support. Usually you will require a paid hosting service. I will provide the new code below.

You should make necessary changes in SMTP and  smtp_port settings. You can change these settings in the php.ini file on your server. You can contact the support of the hosting server for the correct setting.

The program given above will display a form that initially contains the address of the recipients email and the subject of your email. Then a text area for entering the body of the email also will be displayed. You can enter the address, subject and the body of the email and then click the submit button. This will post the value of the form elements in the file given in the action attribute of the form tag. Here I have called the same file by using the PHP server variable. The program initially checks whether the form has been submitted by using the POST variable of the PHP. If the form has been submitted then that variable will be set. If that variable is not set then it will display the form to the user.

So when the form is submitted by the user it will call the PHP mail function, its default parameter is the address to which the mail should be sent, the second parameter is the subject of your email and the third parameter is the body of the email. After that if you want then you can give additional headers for formatting the content of your email, so that you can adjust how it will look in the clients email. These additional headers are optional; if it is not given it will take the default setting for your server. Here if the mail is successfully sent then the mail function will return true, so the message “thank you for using our mail form will be displayed” otherwise “mail sending failed message” is displayed.

 

Answered By 5 points N/A #107739

Problem of PHP mail function

qa-featured

Hi,

Kamerun PHP is almost a simple language which looks similar to "C" and can be integrated easily with cms like Joomla as they are user friendly. 

And here is the small bug with the Case Sensitivity when you set it up at first but it will be worked well once you sort it out that file and one more thing is that PHP is the like the scripting language and it's difficult to convert it from ppt to PHP.

You can manually do it by using PHP basics and ppt basics how to convert it, and the actual quality will be erased even if you convert it manually from one extension to another so it’s better to maintain the format of the extension you have rather than losing its quality.

Even images play a major role in both so that if the quality of the image is lost then it’s very tough to make it understand so it’s better not to perform the conversion.

Hence in regards to the PHP mail function hope the data provided above may give you a perfect solution in solving your query you are having with PHP.

Thank you..: -)

Related Questions