• Aldo_F
  • NEWBIE
  • 0 Points
  • Member since 2011

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

I am getting an error with the line "mail.setToAddresses" in the following code:

 

String email = '';
String ownerName = '';
// Check if Owner is a User if (ownerType == 'User'){ User owner = [select Name, Email from User where Id = :c.OwnerId]; email = owner.Email; ownerName = owner.Name; System.debug('Email: ' + email + ', Name: ' + ownerName); String[] toAddresses = new String[]{email}; mail.setToAddresses(toAddresses); ...

 The debug message is outputting the Email (and Name) just fine, so I am not sure what the problem is. I use the same syntax is another method and it works just fine, so I'm really not sure what the issue is. Any ideas?