FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Changing e-mail/name for e-mail sent from my site





welshsteve
Hi everyone.

How do I change the name and address that e-mail sent from forms on my site (using php's mail function)?

I've heard it's a php.ini setting. Therefore, is there anything I can add to my script to override the default settings. It currently appears to be from frihostusername@domain.co.uk i.e. welshsteve@ldbsa.co.uk in my case. I want it to be from a different e-mail address.
rvec
http://nl3.php.net/manual/en/function.mail.php
second example
no php.ini setting needed Smile
welshsteve
Hi, I've tried this and it doesn't seem to work. Here's my code. Have I done something wrong?

Code:

<?php
  $contactname = $_REQUEST['contactname'] ;
  $email = $_REQUEST['email'] ;
  $division = $_REQUEST['division'] ;
  $week = $_REQUEST['week'] ;
  $teamhome = $_REQUEST['teamhome'] ;
  $teamaway = $_REQUEST['teamaway'] ;
  $scorehome = $_REQUEST['scorehome'] ;
  $scoreaway = $_REQUEST['scoreaway'] ;
  $headers = 'From: steve.williams@ldbsa.co.uk' . "\r\n" .
    'Reply-To: steve.williams@ldbsa.co.uk' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
  if (!isset($_REQUEST['email'])) {
    header( "Location: http://www.ldbsa.co.uk/s_submitscore.php" );
  }
  elseif (empty($contactname) || empty($email) || empty($division) || empty($week) || empty($teamhome) || empty($teamaway) || (empty($scorehome) && ($scorehome !== "0")) || (empty($scoreaway) && ($scoreaway !== "0"))) {
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=shift_jis" />
   <title>Leamington and District Billiards and Snooker Association  - Feedback Form Error</title>
   <link rel="stylesheet" type="text/css" href="../css/css_main.css" />
</head>
<body>
<div id="header">
   <?php include "includes/header.php";?>
</div>
<div id="sponsors">
   <?php include "includes/sponsors.php";?>
</div>
<div id="wrapper">
    <div class="leftMenu">
        <?php include "includes/nav.php";?>
   </div>
   <div class="content">
      <h1>ERROR</h1>
      <p>Not all fields have been filled in.  Please try again.</p>
      <p><a href="../s_submitscore.php"><< Back to form</a>
   </div>
   <div class="rightMenu">
        <?php include "includes/nav_snooker.php";?>
        <?php include "includes/nav_s_results.php";?>
    </div>
</div>
<div id="footer">
   <?php include "includes/footer.php";?>
</div>
</body>
</html>
';
}
  else {
    mail( "$email", "Snooker Match Score Submission",
          "Leamington and District Billiards and Snooker Association", "Dear $contactname,\n\nThank you for submitting your match score and details.\n\nHere are the details of the scores you sent.  Please double check and let me know if there are any errors:\n\n------------------------------------------------------------\n\nDIVISION: $division Division\n\nMATCH WEEK: $week\n\nMATCH SCORE:\n$teamhome $scorehome-$scoreaway $teamaway\n\n------------------------------------------------------------\n\nMany thanks once again.\n\nKind regards\n\nSteve Williams\nSnooker Match Secretary",$headers) ;
    header( "Location: http://www.ldbsa.co.uk/thanksscore.php" );
  }
?>
Related topics
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.