Welcome Guest, Not a member yet? Register   Sign In
Send newsletter to mail list, pass name intomail body.
#1

[eluser]yorvik[/eluser]
Hello

I am making a small newsletter system. Everything works fine for now. But I want in my mail body the name from the person who is receiving the newsletter. For example

Persons in my mailinglist (john, mark , duncan). My mailinglist is saved in a database table newsletter [id, name, frontname, email].

What I want in my newsletter is for exaple :

Hello John,

....

This is my code for writing the body of the newsletter.
Code:
<?php

echo form_open('newsletter_controller/mailNewsletter');

echo '<input type="text" name="subject" id="subjectNewsletter" />';

echo '<textarea name="message" id="message">';
echo 'Hello this is a test newsletter </textarea>';

echo form_submit('submit', 'Send newsletter');
echo form_close();

I have this function for sending my newsletter

Code:
function mailNewsletter()
    {
      
     $subject = $this->input->post('subject');
        $email = "[email protected]";
        $message = $this->input->post('message');

        $mailList = array('[email protected]', '[email protected]','[email protected]');


        $this->load->library('email');
        $this->email->set_newline("\r\n");

        $this->email->from('[email protected]', 'Sven maes');
        $this->email->to($mailList);
        $this->email->subject($subject);
        $this->email->message($this->load->view('source',$message,true));


        if ($this->email->send($message)) {

            $data['main_content'] = 'newsletter_send';
            $this->load->view('includes/template',$data);

        } else {
            show_error($this->email->print_debugger());
        }
    }

Now how is it possible to write the names automaticly from each mailing subscriber, that are saved in the database?


Messages In This Thread
Send newsletter to mail list, pass name intomail body. - by El Forum - 11-14-2011, 09:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB