SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Email Script Not Working

    Hello,

    I have a script that will send an email to somebody. The form is located here. However, when I open up the email (in Outlook Express) the message is repeated twice. Why is this? You can look at the source for the form code, and here is the PHP script:
    PHP Code:
    <?php

    // define following variables. if one does not apply, leave BLANK 
    $recipient $recipient;
    $recipientemail $recipientemail;
    $subject $subject;
    $message $message;
    $fromname $fromname;
    $fromemail $fromemail;

    // recipients 
    $recipient .= "$recipient <$recipientemail>";

    // subject 
    $subject "$subject";

    // message 
    $message .= "$message";

    // you can add a stock signature // 
    // to add signature, remove comments on next 2 lines 
    // $message .= "--\r\n"; //Signature delimiter 
    // $message .= "Birthday reminder copylefted by public domain"; 

    // additional header pieces for errors, From cc's, bcc's, etc 
    $headers .= "From: $fromname <$fromemail>\n";
    $headers .= "X-Sender: <$fromemail>\n"
    $headers .= "X-Priority: 1\n"// Urgent message!
    $headers .= "Return-Path: <$fromemail>\n";  // Return path for errors

    // If you want to send html mail, uncomment the following line 
    // $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type

    // to use CC, uncomment following line 
    // $headers .= "cc: [email]birthdayarchive@php.net[/email]\n";

    // and now mail it! 
    mail($recipient$subject$message$headers);

    ?>
    Why is it repeating in the email? If you want to, you can send an email to yourself, and see what I mean. Also, how can I make it output some text once the email is sent?

    Any help would be appreciated.
    Last edited by JustForWebmasters; Jun 15, 2001 at 12:51.
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See my comments in your code

    PHP Code:
    //Because you first assign $message to $message
    $message $message;
    $fromname $fromname;
    $fromemail $fromemail;

    // recipients 
    $recipient .= "$recipient <$recipientemail>";

    // subject 
    $subject "$subject";

    // then you tack on another copy of message here.
    $message .= "$message"
    And actually you can just use $message in the mail() command like you did, no need to reassign it at all so just remove the $message = $message and the $message .= $message; And you should be fine.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you, Louis.

    It works now!
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •