• tsailing.sfdc
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

There's been a change in the Salesforce API that causes emails to not be sent when there are spaces around the email address string.

 

(Debug log message shown below)

This string of email addresses resulted in Email not sent -- ccAddresses: [tsailing.test1@gmail.com,  tsailing.test2@gmail.com,  tsailing.test3@gmail.com]

This string of email addresses resulted in Email sent -- ccAddresses: [tsailing.test1@gmail.com,tsailing.test2@gmail.com,tsailing.test3@gmail.com]

 

The main issue is that there will be NO ERRORS RETURNED OR DISPLAYED to inform users that their emails were not sent. In fact, the system WILL RETURN A SUCCESS MESSAGE.

 

Here's the debug message received -- (Messaging.SendEmailResult[getErrors=();isSuccess=true;])

 

This is NOT an acceptable API behavior.

 

 

Sample code used --

Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 

    String toRecipients = 'tsailing.test1@gmail.com';
    String[] toAddresses = toRecipients.split(';', 0);
    email.setToAddresses( toAddresses );
    System.debug('------------------- 7/1/2012: toAddresses: '+toAddresses);

String ccRecipients = 'tsailing.test2@gmail.com,  tsailing.test3@gmail.com,  tsailing.test4@hotmail.com';
    String[] ccAddresses = ccRecipients.split(',', 0); //switched this to "ccRecipients.split(', ', 0)" resolved the issue.
    email.setCcAddresses(ccAddresses);
    System.debug('------------------- 7/1/2012: ccAddresses: '+ccAddresses);
try {
    email.setSubject('test');
    email.setPlainTextBody('test');
    email.setBccSender(true);
} catch (Exception e) {
System.debug('------------------- 7/1/2012: e: '+e);
}

Messaging.SendEmailResult [] r = 
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});   
System.debug('------------------- 7/1/2012: r: '+r);

 

There's been a change in the Salesforce API that causes emails to not be sent when there are spaces around the email address string.

 

(Debug log message shown below)

This string of email addresses resulted in Email not sent -- ccAddresses: [tsailing.test1@gmail.com,  tsailing.test2@gmail.com,  tsailing.test3@gmail.com]

This string of email addresses resulted in Email sent -- ccAddresses: [tsailing.test1@gmail.com,tsailing.test2@gmail.com,tsailing.test3@gmail.com]

 

The main issue is that there will be NO ERRORS RETURNED OR DISPLAYED to inform users that their emails were not sent. In fact, the system WILL RETURN A SUCCESS MESSAGE.

 

Here's the debug message received -- (Messaging.SendEmailResult[getErrors=();isSuccess=true;])

 

This is NOT an acceptable API behavior.

 

 

Sample code used --

Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 

    String toRecipients = 'tsailing.test1@gmail.com';
    String[] toAddresses = toRecipients.split(';', 0);
    email.setToAddresses( toAddresses );
    System.debug('------------------- 7/1/2012: toAddresses: '+toAddresses);

String ccRecipients = 'tsailing.test2@gmail.com,  tsailing.test3@gmail.com,  tsailing.test4@hotmail.com';
    String[] ccAddresses = ccRecipients.split(',', 0); //switched this to "ccRecipients.split(', ', 0)" resolved the issue.
    email.setCcAddresses(ccAddresses);
    System.debug('------------------- 7/1/2012: ccAddresses: '+ccAddresses);
try {
    email.setSubject('test');
    email.setPlainTextBody('test');
    email.setBccSender(true);
} catch (Exception e) {
System.debug('------------------- 7/1/2012: e: '+e);
}

Messaging.SendEmailResult [] r = 
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});   
System.debug('------------------- 7/1/2012: r: '+r);