Jump to content

Archived

This topic is now archived and is closed to further replies.

tomfmason

simple mail question

Recommended Posts

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

[code=php:0] $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');[/code]

and here is another one

[code=php:0] $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');[/code]


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

Share this post


Link to post
Share on other sites
Why did you change the headers?

Try this and see if this fixes your problem:

[code]
      $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";
[/code]

Share this post


Link to post
Share on other sites
[quote author=kalivos link=topic=101411.msg401328#msg401328 date=1153504798]
Why did you change the headers?

Try this and see if this fixes your problem:

[code]
      $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";
[/code]
[/quote]

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

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

[code=php:0] $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";[/code]

Share this post


Link to post
Share on other sites
This just hit me... Try the following:

[code]
    $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');[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.