PHP Classes
elePHPant
Icontem

What is the best PHP class to extract recipients from CSV file?: I need to parse a .csv emails address list and send a message

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  All requests RSS feed  >  What is the best PHP class to extract recipients from CSV file?  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

What is the best PHP class to extract recipients from CSV file?

Edit

Picture of ramon espinel by ramon espinel - 1 year ago (2014-11-05)

I need to parse a .csv emails address list and send a message

This request is clear and relevant.
This request is not clear or is not relevant.

+1

When I send message it is delivered several times, Not just once. This is my script:

<?php require_once('class.PHPMailer.php'); include("class.smtp.php");

$mail = new PHPMailer();

$mail->isSMTP(); $mail->Host = "mail.gmail.com"; $mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->Username = "mymail@gmail.com"; // GMAIL username $mail->Password = "mypsswrd"; // GMAIL password

$mail->SetFrom('mymail@gmail.com', 'Just Me');

$mail->AddReplyTo("mymail@gmail.com");

$mail->Subject = "Subject";

$mail->Body = " Mail Message"; // optional, comment out and test

$row = 1; if (($handle = fopen("test.csv", "r")) !== FALSE) {

while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
    $num = count($data);
    $row++;
  for ($c=0; $c < $num; $c++) {
        //echo $data[$c] . "<br />\n";			

$address = $data[$c]; $mail->AddAddress($address);

$mail->AddAttachment("new.txt"); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; } } } } ?>

Ask clarification

2 Recommendations

Quick CSV import: Import CSV data into a MySQL database table

This recommendation solves the problem.
This recommendation does not solve the problem.

+2

Picture of Manuel Lemos by Manuel Lemos Reputation 11100 - 1 year ago (2014-11-12) Comment

This class is also a good solution if you want to import your address from a CSV file to MySQL database, so you can query the database later to extract the recipients of your mailing.

The author has written a nice article about how to import data from CSV files.


Parse importer: Import email addresses into a MySQL database

This recommendation solves the problem.
This recommendation does not solve the problem.

+2

Picture of Oliver Leuyim Angel by Oliver Leuyim Angel package author package author Reputation 55 - 1 year ago (2014-11-05) Comment

with this you will be able to get all the mails and verify them to send mails.

see files and there are examples

  • 3 Comments
  • 1. Picture of Manuel Lemos by Manuel Lemos - 1 year ago (2014-11-06) Reply

    I am not sure if this class can read files in CSV format.

    I think Ramon wants something that reads emails from CSV files and add them as recipients, rather than importing into a database, although the database storage can be useful to send future mailing campaigns and manage the mailing list online.

  • 2. Picture of ramon espinel by ramon espinel - 11 months ago (2015-02-24) Reply

    Hello. Don't know why it was today i receive your import class message. By this time i already solve the situation but i believe your importer was good to do it too. Thank you.

  • 3. Picture of Manuel Lemos by Manuel Lemos - 11 months ago (2015-02-24) in reply to comment 2 by ramon espinel Reply

    There was an issue with the system that was not sending notifications about updates on this recommendation.


Recommend package
: 
: