Jump to content

simple mail question


tomfmason

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.