You need to sign in to do that
Don't have an account?
What exactly is this "Messaging" in Messaging.SingleEmailMessage?
Hi guys
Can someone please shed some light on this?
I've seen Messaging.SingleEmailMessage in the apex documentation.
So what is it exactly this Messaging is? Is it a class? An object? Is it an Apex reserved word?
By looking at this syntax:
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
it looks to me that Messaging is a class and SingleEmailMessage is a static method and that's how you can have this syntax. But I have been looking high and low on documentation about this "Messaging" class and I couldn't find any information.
Can you send me a URL from salesforce that teaches this Messaging class (if it is indeed a class)?
Thank you very much.
King
You're right, messaging is a class.
SingleEmailMessage, MassEmailMessage, InboundEmail, etc. are also classes that were defined WITHIN the Messaging class. Much like Apex class within an Apex class.
OOP programmers use this technique to organize objects. i.e. all, objects pertaining to messaging are bundled in "Messaging".
"Messaging" resembles more of a namespace in VB/C#.net or package in java.
if you have not seen this documentation, perhaps you could start from there.
Hi there
Thank you very much for your quick response.
Yes I have seen this, and that's why I asked the question on the board.
Even though there are some information about the static functions as you suggested, I couldn't see anywhere that talked about this Messaging class itself. Is there any one page that has the references on "Messaging Class"?
The reference I book, a few documents that I found on the internet, they just talk about Messaging.SingleEmailMessage as if from nowhere. So I would like get a list of all methods, static methods, etc on the Messaging class.
Thanks
King
even Force IDE (Eclipse) lists only the four static methods mentioned in the documentation.
so there's nothing undocumented i guess. if there's anything useful other than those, I don't see a single reason why would Salesforce not release those.
Think I'm having a little brain diarrhea today... so let me ask the question this way.
What is Messaging in relation to SingleEmailMessage?
Are they both classes, which means Messaging is a parent class and SingleEmailMessage inherits from it?
I mean, if I have a class called Testing, i.e. public class Testing()),
then when I initialize an instance, I'll go
Testing mytest = new Testing();
So I understand "Messaging.SingleEmailMessage" is a class. But atomically, are Messaging and SingleEmailMessage themselves individually classes in which SingleEmailMessage is inherited from Messaging?
Hope I'm not confusing you.
Thanks again.
^ they are not the same.
as I said in my very first reply, SingleEmailMessage is class within another class called "Messaging".
A class within a class does not necessarily mean that the inner class (SingleEmailMessage) is inherited/derived from the parent (Messaging) class. As I look at it, SingleEmailMessage is not inherited from Messaging class, because SingleEmailMessage does not posses the methods of the Messaging class. This in turn corroborates to the documentation that Messaging.SingleEmailMessage and Messaging.MassEmailMessage were inherited/derived from Messaging.Email base class.
to illustrate, they would look much like this in the Apex Code:
P.S. you cannot even define a variable/object of type Messaging (i.e. Messaing msg = new Messaging()), so as I previously mentioned, Messaging resembles much of a namespace, rather than a class.
Interesting. I was just going to ask you if this "dot notation" is a common thing in OO world to represent classes, but then at the end you mentioned namespace.
Pleaes give me a few days to research namespace, I am still struggling with the fact that Salesforce documentation simply just talked about Messaging.SingleEmailMessage without any introduction on Messaging at all.
Once I think I understand the subject better, I'll come back for more questions or will tag your last comment as the accepted solution.
Thanks!!
King
i meant resembles namespace in C#/VB.net
namespace in apex is via "_" (underscore)
and yes dot notation is a common thing in OOP language.