You must Sign In to post a response.
  • Category: ASP.Net MVC

    Email with mailchimp

    I have created Campaign in Mailchimp account and through Now I want to
    send Email Programatically in C#. Actually i am
    new to this concept and want to send newsletter to users who have
    subscribed to campaign. Please Provide any Sample code or method to
    implement this.

    1.) Is there any way to get campaignid required in campaignSendNow()
    method dynamically in C#. Currently i have hard code the id and it
    work fine.But i want to do all dynamically.

    2.) I want to send newsletter email from C# . i have created List and
    Campaign on Mailchimp account. In my code with Listsubscribe() method
    i am subscribing users to list and then making campaign with
    subscribed users.To send newsletters to those subscribed users i need
    campaignid (cid) but i can not get it dynamically. I want to integrate
    this module on website. please suggest any steps or methods for
    newsletter subscription with C# code.

    3.) What are basic steps for create and send newsletter on Mailchimp
    account and way to access it from C# with required methods.
  • #763868
    If you want to send a NewsLetter then it is recommended to send it with HTML format, see below snippet to send mail

    SmtpClient sc = new SmtpClient("mail address");
    MailMessage msg = null;

    try
    {
    msg = new MailMessage("xxxx@gmail.com",
    "yyyy@gmail.com", "Message from PSSP System",
    "This email sent by the PSSP system<br />" +
    "<b>this is bold text!</b>");

    msg.IsBodyHtml = true;
    }

    catch (Exception ex)
    {
    throw ex;
    }

    finally
    {
    if (msg != null)
    {
    msg.Dispose();
    }
    }
    OR
    you can design/create a HTML file with all your news letter content and attach whole body as html page
    see below body syntax
    string Body = System.IO.File.ReadAllText(Server.MapPath("NewsLetter.html"));

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


Sign In to post your comments