Have you played with Eloqua’s Email API yet? Eloqua’s SOAP API exposes operations for sending and tracking email messages. It also provides endpoints for creating emails, editing content and configuring details such as the sender and recipient lists. In this post, we’ll demonstrate a very basic use-case that uses this service to create an Email and send it to a list of recipients.

If you're working with Eloqua 10, please see the following post on Sending Emails using the REST API.

Please note that you’ll need to have API access and should be familiar with how to connect with the Eloqua SOAP API. For documentation and additional details please see the Email Service API Overview.

Developers can use this web service to build applications that perform tasks such as displaying, composing and sending emails. As an example, consumers could leverage the API to create their own Eloqua Email Editor.

We’re starting with the basics in this post. The following code sample demonstrates how to create and send an Email via the SOAP API. Please note that you will need to add a service reference to the Email Service WSDL in your application.

Email Service WSDL : https://secure.eloqua.com/API/1.2/EmailService.svc

Sample code c#

    // Instantiate a new instance of the Email client
    EmailServiceClient emailClient = new EmailServiceClient();

    // Set your API user credentials
    emailClient.ClientCredentials.UserName.UserName = @"ClientName\UserName";
    emailClient.ClientCredentials.UserName.Password = "xxxxx";

    // Set the email details
    EmailDetails email = new EmailDetails
                                                BouncebackAddress = "admin@eloqua.com",
                                                Name = "Email Service Client - Sample Code",
                                                FromAddress = "",
                                                FromName = "",
                                                ReplyToAddress = "",
                                                ReplyToName = "",
                                                NeverExpires = true,
                                                SendToUnsubscribes = false,
                                                HtmlContent = "<html><body></body></html>",
                                                TextContent = "",
                                                AutoGenerateTextContent = true,
                                                Subject = "Email Service Client - Sample Code",
                                                Tracked = true,
                                                SendHtml = true,
                                                HeaderId = 106, // see endpoints for listing Headers
                                                FooterId = 3, // see endpoints for listing Footers
                                                EncodingId = 1,
                                                GroupId = 1,

        // Invoke a service request to create the Email
        email.Id = emailClient.CreateHtmlEmail(email);

        // Update the Email's content
        email.HtmlContent = "<html><body>Updated Content</body></html>";

        // Invoke a service request to update the Email
    catch (Exception ex)

    // Configure the Email deployment settings
    DeploymentSettings settings = new DeploymentSettings
                                            Name = "Deployment Settings - Sample",
                                            EmailId = email.Id,
                                            AllowResend = false,
                                            DistributionListId = 1,
                                            NotificationEmailAddress = "fred.sakr@eloqua.com",
                                            SignatureRuleId = 3,
                                            SendOnBehalfOfUser = "fred.sakr@eloqua.com",
                                            AllowSendToBouncebacked = false,
                                            AllowSendToUnsubscribed = false,
                                            AllowSendToEmailGroupUnsubscribed = false,
                                            AllowSendToMasterExcludeList = false,

        // Deploy the Email
        Deployment deploy = emailClient.Deploy(settings);

        // Retrieve the state
        deploy = emailClient.GetDeployment(deploy.Id);

        // Write your own custom code to poll the API and verify the state of the deployment
    catch (Exception ex)