Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue calling send smart email #46

Open
praveendotnet opened this issue Mar 2, 2017 · 2 comments
Open

Issue calling send smart email #46

praveendotnet opened this issue Mar 2, 2017 · 2 comments

Comments

@praveendotnet
Copy link

I didn't find examples on how to use this API https://api.createsend.com/api/v3.1/transactional/smartEmail/{:smartEmailID}/send

I have to call this from c#.net, we are developing a windows service from which we have to call the above and send emails. I have the API key and JSON request, how to send the request.

Please provide some samples.

@joshnoe
Copy link

joshnoe commented Sep 28, 2017

This is a duplicate of issue #32 which is also unanswered. I've emailed support about this. If I get any info, I'll create a pull request to add this to the README.

@joshnoe
Copy link

joshnoe commented Oct 24, 2017

Here's a sample that sends multiple emails:

public void SendEmails(string emailTemplateId, IEnumerable<UserDTO> users)
{
    var transactional = Authenticate.ByClientApiKey(_apiKey);
    // This is the unique identifier for this smart email
    var smartEmailId = new Guid(emailTemplateId);

    // build up the email
    foreach (var user in users)
    {
        var builder = transactional.MessageBuilder();
                
        builder.To(user.EmailAddress)
            .Data(new Dictionary<string, object>
            {
                { "firstName", user.FirstName },
                { "lastName", user.LastName }
            });

        // Send the email
        builder.Send(smartEmailId);
   }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants