Created
June 6, 2012 07:05
-
-
Save venomjke/2880361 to your computer and use it in GitHub Desktop.
Утилита для множественной рассылки писем от указанного email'a, работающая на базе codeigniter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function email() | |
{ | |
$from_email = ''; | |
$from_pass = ''; | |
$text = ""; | |
$file = 'spam/mails2.txt'; | |
$email_content = file_get_contents(FCPATH.$file); | |
if(empty($email_content)){ echo "no content load"; return; } | |
$email_content = preg_split('/\s/',$email_content); | |
if(empty($email_content)){ echo "no content after explode"; return; } | |
$this->load->library('email'); | |
$config['smtp_host'] = 'smtp.yandex.ru'; | |
$config['smtp_port'] = 25; | |
$config['smtp_user'] = $from_email; | |
$config['smtp_pass'] = $from_pass; | |
$this->email->initialize($config); | |
foreach($email_content as $email_record){ | |
if(!empty($email_record)){ | |
echo "email_record is $email_record <br/>"; | |
$this->email->set_newline("\r\n"); | |
$this->email->from($from_email, ''); | |
$this->email->to($email_record); | |
$this->email->subject(''); | |
$this->email->message($text); | |
// Set to, from, message, etc. | |
$result = $this->email->send(); | |
} | |
} | |
echo "spam finished"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment