EventDay / Infusionsoft.net

A C# Wrapper around the Infusionsoft.com API
16 stars 22 forks source link

How to send an email #31

Closed jhallam3 closed 9 years ago

jhallam3 commented 9 years ago

Hi,

Im trying to send an email without the templateID, however I only get the option to send with the templateID.

Im sending public bool SendEmail(int[] ContactsIDToSendTo, string FromEmail, string Subject, string HTMLBody) { var client = customer.Connect();

         var email = client.EmailService.SendEmail(ContactsIDToSendTo, FromEmail, "jon@email.com", "jon@email.com", "jon@email.com", "HTML", Subject, HTMLBody, "", 0);

        return email;

    }

looking further in to it the https://developer.infusionsoft.com/docs/xml-rpc/#email-send-an-email says the template is of type string not int. (which makes no sense because its an ID...)

Error details An unhandled exception of type 'InfusionSoft.InfusionSoftException' occurred in InfusionSoft.dll

Additional information: Server returned a fault exception: [0] No method matching arguments: java.lang.String, [Ljava.lang.Object;, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer

jhallam3 commented 9 years ago

I've downloaded the most resent code from here, and it works HOWEVER.

It sends the email but the result that is returned is when it successfully sends the email is a False. NOT at true.

Any suggestions?

trbngr commented 9 years ago

The infusionsoft api is a moving target.

It would seem logical to send an email using the overload without the templateId (which seems to work but I didn't receive the email).

The overload with the templateId doesn't work using an int or a string.

To make things worse, SendTemplate doesn't work with an int or a string. And the docs say that TemplateID is a string but the example says it's an int.

Without Infusionsoft support, I'm afraid there's nothing I can do here.

mfairch commented 9 years ago

@jhallam3 @trbngr

In the example code provided, a templateId is being passed in, the sendEmail method (when not using a template) doesn't accept the templateId so it needs to be removed from that method.

Here are the parameters that are needed.

String key, List contactList, String fromAddress, String toAddress, String ccAddresses, 
String bccAddresses, String contentType, String subject, String htmlBody, String textBody

When using a template (which uses sendEmail, it's an overloaded method) you need these parameters.

String key, List contactList, Integer templateId

Let me know if this doesn't work for you.