Welcome Guest, Not a member yet? Register   Sign In
send message to all email adresses of a table in a view
#1

[eluser]Unknown[/eluser]
Hello,

i hope somebody can help me:

i have a table in my view:
Code:
<?php echo form_open('sektionssprecher/sendemail')?>
<table >
  <thead>
   <tr>
    
    <th>Benutzername</th>
    <th>Vorname</th>
    <th>Nachname</th>
    <th width="200"> Email</th>
   </tr>
  </thead>
  
  <tbody>
  
   &lt;?php foreach ($users as $member): ?&gt;
    <tr>
    
     <td>&lt;?php echo $member->display_name ?&gt;</td>
     <td>&lt;?php echo $member->first_name ?&gt;</td>
     <td>&lt;?php echo $member->last_name ?&gt;</td>
     <td>&lt;?php echo mailto($member->email) ?&gt;</td>
    
    
    </tr>
   &lt;?php endforeach ?&gt;
  </tbody>
</table>
&lt;?php echo form_button('sendemail','send message to all'); ?&gt;
&lt;?php echo form_close() ?&gt;

Now i want to read out all the emailadresses of this table and send it to the controller "sektionssprecher":

with "public function sendemail()" i want to send the data to a new view, where i can write my text and send it via button to all the emailadresses from this table:
Code:
&lt;?php


echo form_open();
echo form_textarea();
echo form_button('sendemail','send message to all');
echo form_close()

?&gt;

Can somebody pls help me??

sorry for my bad english...
#2

[eluser]j0se[/eluser]
IMHO I do all in one task:

In the view:
Code:
&lt;?php echo form_open('sektionssprecher/sendemail')?&gt;
<table >
  <thead>
   <tr>
    <th>Benutzername</th>
    <th>Vorname</th>
    <th>Nachname</th>
    <th width="200"> Email</th>
   </tr>
  </thead>
  <tbody>
   &lt;?php foreach ($users as $member): ?&gt;
    <tr>
     <td>&lt;?php echo $member->display_name ?&gt;</td>
   <td>&lt;?php echo $member->first_name ?&gt;</td>
  <td>&lt;?php echo $member->last_name ?&gt;</td>
     <td>&lt;?php echo mailto($member->email) ?&gt;</td>
    </tr>
   &lt;?php endforeach; ?&gt;
  </tbody>
</table>
&lt;?php echo form_textarea();?&gt;
&lt;?php echo form_button('sendemail','send message to all'); ?&gt;
&lt;?php echo form_close() ?&gt;


In controller:


Code:
foreach ($users as $member):

$this->email->from('[email protected]', 'Your Name');
$this->email->to($member->email);
$this->email->subject('SUBJECT YOU CAN PASS IT FROM INPUT TEXT ');
$this->email->message($this->input->post('TEXTAREA VALUE');
$this->email->send();

endforeach;
#3

[eluser]Unknown[/eluser]
hey, thank you for helping me Smile

now i did it with your solution but when i´m using
Code:
show_error($this->email->print_debugger())
i get this error message:

Code:
An Error Was Encountered [ 500 ]

220 mx.google.com ESMTP l6sm5224127eem.9 - gsmtp

hello: 250-mx.google.com at your service, [89.14.207.199]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
250 ENHANCEDSTATUSCODES

lang:email_smtp_auth_pw
lang:email_send_failure_smtp

User-Agent: CodeIgniter
Date: Wed, 15 May 2013 19:15:13 +0200
From: "Your Name"
Return-Path:
To: [email protected]
Subject: =?utf-8?Q?SUBJECT_YOU_CAN_PASS_IT_FROM_INPUT_TEXT_?=
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0


Content-Type: multipart/alternative; boundary="B_ALT_5193c2a1822db"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_5193c2a1822db
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Hallo steffen,


--B_ALT_5193c2a1822db
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hallo steffen,

--B_ALT_5193c2a1822db--

but i don´t understand it. Sad

#4

[eluser]j0se[/eluser]
its sounds that email settings its wrong...

in google "gmail + codeigniter" the first result look the config settings




Theme © iAndrew 2016 - Forum software by © MyBB