Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Trying to use sendEmail() SOAP functionality (generating XML as in this example).

According to the sendEmail() documentation you can use a list of emails in the toAddresses field.

How are these delimited in the SOAP XML message? I have tried space and comma but neither seems to work.

share|improve this question
So you tried message.setToAddresses(new String[] { "", "" }); – techtrekker Feb 20 '13 at 11:22
try semi-colon? – Ray Feb 20 '13 at 13:51
semi-colon does not seem to work either... – leighman Feb 26 '13 at 13:55
up vote 2 down vote accepted

They are not delimited within the <toAddresses> element instead you should have multiple <toAddresses> elements, one for each address.

share|improve this answer

It's not delimited, you provide an array of strings, where each item in the array is an email address you want to send to.

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {''};
share|improve this answer
I am constructing the XML myself. How are they delimited in the XML? – leighman Feb 20 '13 at 11:27
Aha, but you didn't say anything about SOAP before, i'm sorry, I don't have experience with the SOAP API nor constructing it via XML – pjcarly Feb 20 '13 at 11:50
@PJC Always i prefer watching the Tag:). – Mohith Shrivastava Feb 20 '13 at 11:53
Just wondering if there's a reason you're not just using the wrapper classes in Java / C# which would generate the XML for you ? – techtrekker Feb 20 '13 at 11:58
I did mention SOAP but didn't make it clear that I needed to construct the XML myself. Sorry. I am working on a desktop C app so cannot use the Java / C# examples. – leighman Feb 20 '13 at 12:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.