Jump to content


Photo

simple mail question


  • Please log in to reply
5 replies to this topic

#1 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 21 July 2006 - 05:55 PM

I have a register form that I changed alittle bit for a friend. I use a different system for sending mail and am not used to the X-Mailer.

here is what I have tried so far

$to = '$email_address';
    $subject = 'Your Membership at Settle The Score!';
    $message = 'Dear $first_name $last_name, 
    You are now registered at our website, http://www.stsclan.com! 
     
    To activate your membership, please login here: http://www.stsclan.com/login.php  
     
    Once you activate your membership, you will be able to login with the following information: 
    <b>Username:</b> <font color=\"#FF0000\">$username</font> 
    <b>Password:</b> <font color=\"#FF0000\">$password</font> 
    Please keep this username and password in a location that is easily accessible by you. 
     
    Thanks! 
    WebMaster
     
    This is an automated response, please do not reply!';
    $headers = "From: leader@stsclan.com X-Mailer/PHP phpversion() ";
    mail($to, $subject, $message, $headers)or die('something went wrong');

and here is another one

$to = '$email_address';
    $subject = 'Your Membership at YourSite.com';
    $message = 'Dear $first_name $last_name, 
    You are now registered at our website, http://www.yoursite.com! 
     
    To activate your membership, please login here: http://www.yoursite.com/login.html  
     
    Once you activate your membership, you will be able to login with the following information: 
    <b>Username:</b> <font color=\"#FF0000\">$username</font> 
    <b>Password:</b> <font color=\"#FF0000\">$password</font> 
    Please keep this username and password in a location that is easily accessible by you. 
     
    Thanks! 
    WebMaster, YourSite.com 
     
    This is an automated response, please do not reply!';
    $headers = "From: noreply@yoursite.com\r\n" .
       'X-Mailer: PHP/' . phpversion() . "\r\n" .
       "MIME-Version: 1.0\r\n" .
       "Content-Type: text/html; charset=utf-8\r\n" .
       "Content-Transfer-Encoding: 8bit\r\n\r\n";
    mail($to, $subject, $message, $headers)or die('something went wrong');


Like I said I am rather sure that this is a simple problem with a simple fix. Any suggestions would be great.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#2 kalivos

kalivos
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationCalifornia

Posted 21 July 2006 - 05:59 PM

Why did you change the headers?

Try this and see if this fixes your problem:

      $headers = "From: leader@stsclan.com\r\n" .
       'X-Mailer: PHP/' . phpversion() . "\r\n" .
       "MIME-Version: 1.0\r\n" .
       "Content-Type: text/html; charset=utf-8\r\n" .
       "Content-Transfer-Encoding: 8bit\r\n\r\n";

Make a donation to phpfreaks. They need your help![br][br]

#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 21 July 2006 - 06:05 PM

Why did you change the headers?

Try this and see if this fixes your problem:

      $headers = "From: leader@stsclan.com\r\n" .
       'X-Mailer: PHP/' . phpversion() . "\r\n" .
       "MIME-Version: 1.0\r\n" .
       "Content-Type: text/html; charset=utf-8\r\n" .
       "Content-Transfer-Encoding: 8bit\r\n\r\n";


That is the same as the second version. The problem iis that it keep displaying the error message Something went wrong

I changed the headers because I assumed that it had to be a problem with the headers. Since he was able to send mail via php before.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#4 kalivos

kalivos
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationCalifornia

Posted 21 July 2006 - 06:16 PM

I'm not sure what you have tried/done. Have you tried the second version? Does it work? You said "he" was able to send mail via PHP before, why not use the same script? Or is it the same script and did it just stop working? I'm affraid I can't be of much help without some info.
Make a donation to phpfreaks. They need your help![br][br]

#5 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 21 July 2006 - 06:24 PM

he was able to send mail via php before but has since erased the file that he sent mail with. If that were the case I would have just compared the two and changed what need to be changed.

I have tried both of the examples that I have posted. I am starting to think that it is the formaton of my headers. I am going to try something like this

$headers = "From: whatever@whatever.com\r\n";
	$headers .= "MIME-Version: 1.0\r\n";
	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
             $headers .= "Content-Transfer-Encoding: 8bit\r\n\r\n";

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#6 kalivos

kalivos
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationCalifornia

Posted 21 July 2006 - 06:32 PM

This just hit me... Try the following:

    $to = $email_address;
    $subject = 'Your Membership at Settle The Score!';
    $message = "Dear ".$first_name." ".$last_name.", 
    You are now registered at our website, http://www.stsclan.com! 
     
    To activate your membership, please login here: http://www.stsclan.com/login.php  
     
    Once you activate your membership, you will be able to login with the following information: 
    <b>Username:</b> <font color=\"#FF0000\">".$username."</font> 
    <b>Password:</b> <font color=\"#FF0000\">".$password."</font> 
    Please keep this username and password in a location that is easily accessible by you. 
     
    Thanks! 
    WebMaster
     
    This is an automated response, please do not reply!";
          $headers = "From: leader@stsclan.com\r\n
          MIME-Version: 1.0\r\n
          Content-Type: text/html; charset=utf-8\r\n
          Content-Transfer-Encoding: 8bit\r\n\r\n";
    mail($to, $subject, $message, $headers)or die('something went wrong');

Make a donation to phpfreaks. They need your help![br][br]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users