Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    49
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Chaning output of php mail message

    Hi I'm implenting a basic php validation mail function. In the process.php file where all the magic works I'd like to change this;

    PHP Code:
    if(!$error)
    {
    $mail mail(WEBMASTER_EMAIL$subject,
         
    "From: ".$name." <".$email.">\r\n"
        
    ."Reply-To: ".$email."\r\n"
        
    ."Message: ".$message."\r\n");

    if(
    $mail)
    {
    echo 
    'OK';

    To somthing like;
    PHP Code:
    if(!$error)
    {
    $mail mail($email$subject 'Comment from website',
         
    "From: ".$name." <".$email.">\r\n"
        
    ."Reply-To: ".$email."\r\n"
        
    ."Message: ".$message."\r\n");

    if(
    $mail)
    {
    echo 
    'OK';

    So when I get the mail I want the person who enters their $email address in the 'From:' line rather than the mail server address and I want the subject: line to be static "Comments from website"....

    Any help much appriciated.
    Last edited by stephen_; 02-28-2013 at 02:16 PM.

  • #2
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    709
    Thanks
    20
    Thanked 84 Times in 84 Posts
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    49
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Arcticwarrio View Post
    Found another link here....

    yet still can't get this to work...

  • #4
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    332
    Thanks
    2
    Thanked 47 Times in 46 Posts
    Look at this change. Note the new order I've placed the message in.

    PHP Code:
    if(!$error)
    {
    $mail mail($email$subject 'Comment from website'$message,
         
    "From: ".$name." <".$email.">\r\n"
        
    ."Reply-To: ".$email."\r\n" );
                
                    

    if(
    $mail)
    {
    echo 
    'OK';


  • Users who have thanked Redcoder for this post:

    stephen_ (03-15-2013)

  • #5
    New Coder
    Join Date
    Jan 2012
    Posts
    49
    Thanks
    13
    Thanked 0 Times in 0 Posts
    @Redcoder Thank you for this. I also need to add To: and From: fields - the from field must be using a domain suffix that is valid - ie the domain is hosted on the server.

    Could I add this to the php processes file?
    Last edited by stephen_; 03-15-2013 at 10:41 AM.


  •  

    Tags for this Thread

    Posting Permissions

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