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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    109
    Thanks
    21
    Thanked 0 Times in 0 Posts

    Smile Contact form Question Codeigniter

    Hi. I have codeigniter. I have set up my contact page but It only shows the message content in message body. php email

    I need to be able to display like this


    (Message Body)

    Senders Name: Sample Joe
    Senders Email: joe@demo.com
    Senders Subject: Subject Line
    Senders Message:
    Blah Blah Blah
    Founder Of Carrara Website Solutions
    http://www.carrarawebsitesolutions.com

  • #2
    New Coder
    Join Date
    May 2005
    Location
    New Zealand
    Posts
    76
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Smile

    It's normally helpful if you can post some of the code you have written, in absence of that I will assume you are using the Codeigniter Email class similar to this (but with the variables posted from your contact form)...

    PHP Code:
    $this->load->library('email');

    $this->email->from('your@example.com''Your Name');
    $this->email->to('someone@example.com'); 
    $this->email->cc('another@another-example.com'); 
    $this->email->bcc('them@their-example.com'); 

    $this->email->subject('Email Test');
    $this->email->message('Testing the email class.');    

    $this->email->send(); 
    If you want the sender's name and other bits in the body of the sent message then you simply need to add this together with some basic string concatenation to a variable first and then set the $this->email->message() to that.

    Example...
    PHP Code:
    $this->load->library('email');

    ... 
    etc ...

    $this->email->subject('Email Test');

    $msgBody "Senders Name:" $sendersName "<br />" .
              
    "Senders Email:" $sendersEmail "<br />" .
              
    "Senders Subject:" $subjectLine "<br />" .
              
    "Senders Message:" $message;

    $this->email->message($msgBody);    
    $this->email->send(); 
    If you are not creating HTML format emails use \n (newline) instead of <br />.

  • #3
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    109
    Thanks
    21
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DougMck View Post
    It's normally helpful if you can post some of the code you have written, in absence of that I will assume you are using the Codeigniter Email class similar to this (but with the variables posted from your contact form)...

    PHP Code:
    $this->load->library('email');

    $this->email->from('your@example.com''Your Name');
    $this->email->to('someone@example.com'); 
    $this->email->cc('another@another-example.com'); 
    $this->email->bcc('them@their-example.com'); 

    $this->email->subject('Email Test');
    $this->email->message('Testing the email class.');    

    $this->email->send(); 
    If you want the sender's name and other bits in the body of the sent message then you simply need to add this together with some basic string concatenation to a variable first and then set the $this->email->message() to that.

    Example...
    PHP Code:
    $this->load->library('email');

    ... 
    etc ...

    $this->email->subject('Email Test');

    $msgBody "Senders Name:" $sendersName "<br />" .
              
    "Senders Email:" $sendersEmail "<br />" .
              
    "Senders Subject:" $subjectLine "<br />" .
              
    "Senders Message:" $message;

    $this->email->message($msgBody);    
    $this->email->send(); 
    If you are not creating HTML format emails use \n (newline) instead of <br />.
    Matthewinfo@demo.comTest Message From Our Development 2
    TestTest Five

    Trying to make it look like this

    Full Name: Matthew
    Email: Info@youremail.com
    Subject: Message From Our Development 2 Test
    Message: Test Five


    $fullname = $this->input->post('fullname');
    $email = $this->input->post('email');
    $subject = $this->input->post('subject');
    $message = $this->input->post('message');

    $this->load->library('email');
    $this->email->set_newline("\r\n");
    $this->email->from($email, $fullname);
    $this->email->to('info@youremail.com');
    $this->email->subject($subject);
    $this->email->message($fullname.$email.$subject.$message);
    Founder Of Carrara Website Solutions
    http://www.carrarawebsitesolutions.com

  • #4
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    109
    Thanks
    21
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DougMck View Post
    It's normally helpful if you can post some of the code you have written, in absence of that I will assume you are using the Codeigniter Email class similar to this (but with the variables posted from your contact form)...

    PHP Code:
    $this->load->library('email');

    $this->email->from('your@example.com''Your Name');
    $this->email->to('someone@example.com'); 
    $this->email->cc('another@another-example.com'); 
    $this->email->bcc('them@their-example.com'); 

    $this->email->subject('Email Test');
    $this->email->message('Testing the email class.');    

    $this->email->send(); 
    If you want the sender's name and other bits in the body of the sent message then you simply need to add this together with some basic string concatenation to a variable first and then set the $this->email->message() to that.

    Example...
    PHP Code:
    $this->load->library('email');

    ... 
    etc ...

    $this->email->subject('Email Test');

    $msgBody "Senders Name:" $sendersName "<br />" .
              
    "Senders Email:" $sendersEmail "<br />" .
              
    "Senders Subject:" $subjectLine "<br />" .
              
    "Senders Message:" $message;

    $this->email->message($msgBody);    
    $this->email->send(); 
    If you are not creating HTML format emails use \n (newline) instead of <br />.
    Problem Sovled Cheers

    Code:
    $fullname = $this->input->post('fullname');
    $email = $this->input->post('email'); 
    $subject = $this->input->post('subject');
    $message = $this->input->post('message');
    
    $this->load->library('email');
    $this->email->set_newline("\r\n");
    $this->email->from($email, $fullname);
    $this->email->to('info@carrarawebsitesolutions.com');
    $this->email->subject($subject);
    $msgBody = "Senders Name:" . $fullname . " \n" . 
     "Senders Email:" . $email . " \n" . 
    "Senders Subject:" . $subject . " \n" . 
    "Senders Message:" . $message; 
    $this->email->message($msgBody);
    Founder Of Carrara Website Solutions
    http://www.carrarawebsitesolutions.com


  •  

    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
    •