Import newsletter emails

9 years ago
The export txt method did not work for me either. I get 0 emails imported prompt.
9 years ago
The exported file cannot be reimported because the export function is wrong.

To fix the problem, you need to change the file ...\NopCommerceStore\Administration\Modules\NewsletterSubscribers.ascx.cs

and replace the function btnExportCVS_Click with the following.   The file generated with this one can be reloaded with the import CSV button.



        protected void btnExportCVS_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    string fileName = String.Format("newsletter_emails_{0}_{1}.txt", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"), CommonHelper.GenerateRandomDigitCode(4));

                    StringBuilder sb = new StringBuilder();
                    var newsLetterSubscriptions = GetNewsletterSubscribers(rbExportCVSActive.Checked);
                    if (newsLetterSubscriptions.Count == 0)
                    {
                        throw new NopException("No emails to export");
                    }
                    for (int i = 0; i < newsLetterSubscriptions.Count; i++)
                    {
                        var subscription = newsLetterSubscriptions[i];
                        sb.AppendFormat("{0}\t{1}\n", subscription.Email, subscription.Active.ToString() );
                    }
                    string result = sb.ToString();
                    CommonHelper.WriteResponseTxt(result, fileName);
                }
                catch (Exception exc)
                {
                    ProcessException(exc);
                }
            }
        }

Thx
9 years ago
I, too, had problems with this. This is what you need to do.

In an Excel spreadsheet enter emails in first column.
Enter TRUE  in column two (for active).
Save as text (tab delimited).

Works like a dream.
2 months ago
NOP v 4.2
I tried all of the methods in this thread and none of them worked. Here is what I did and it worked:

1: I exported the existing newsletter subscribers to get the correct format.
2: What did work was I used excel to check remove duplicates
3: Used excel to check for valid email address using this method on this page:....
https://www.timeatlas.com/find-invalid-emails/
4: I used excel to combine columns in a row to achieve this format.
[email protected],TRUE,1
=arrayformula(B2&C2&D2&E2&F2)
5: I pasted 2500 emails into the exported csv file mentioned in step number 1 and saved it as a txt file.
All of them imported.