We can use the following code for creating and sending an email in CRM
/// <summary>
/// Creating and Sending mail in CRM
/// </summary>
/// <param name=”crmService”>an instance of crmService (CrmService for CRM 3.0)</param>
/// <param name=”members”>ArrayList containing guids of the members</param>
/// <param name=”msg”>The message body</param>
/// <param name=”ownerID”>Owner of the record</param>
/// <param name=”userID”>User under whose context the callout or plugin is running </param>
private void SendMailToMembers(ICrmService crmService, ArrayList members, String msg, String ownerID, String userID)
{
// create an email
email emailCreate = new email();
emailCreate.subject = “MySubject”;
emailCreate.description = msg;
//specify the owner for the mail
emailCreate.ownerid = new Owner();
emailCreate.ownerid.type = EntityName.systemuser.ToString();
emailCreate.ownerid.Value = new Guid(ownerID);
//create an activityparty array holding all the guids specified in the members array list
activityparty[] ap = new activityparty[members.Count];
// creating as many activity party as the no of users or members in a team
int i = 0;
foreach (String memberID in members)
{
ap[i] = new activityparty();
ap[i].partyid = new Lookup();
ap[i].partyid.type = EntityName.systemuser.ToString();
ap[i].partyid.Value = new Guid(memberID);
i++;
}
// specify to part of the email
emailCreate.to = ap;
// specify the from part of the email
activityparty from = new activityparty();
from.partyid = new Lookup();
from.partyid.type = EntityName.systemuser.ToString();
from.partyid.Value = new Guid(userID);
emailCreate.from = new activityparty[] { from };
// finally create the email and get the guid of the email
Guid emailId = crmService.Create(emailCreate);
// FOR CRM 3.0
// Specify the system user who is sending the message.
//crmService.CallerIdValue = new CallerId();
//crmService.CallerIdValue.CallerGuid = new Guid(userID);
//
// Create an SendEmailRequest object
SendEmailRequest req = new SendEmailRequest();
req.EmailId = emailId;
req.TrackingToken = “”;
req.IssueSend = true;
// Finally Send the email message.
SendEmailResponse res = (SendEmailResponse)crmService.Execute(req);
}
Bye
New
LikeLike
Thanks for this blog
LikeLike
thanx
LikeLike
This web site really has all of the information I needed concerning this subject and
didn’t know who to ask.
LikeLike
This paragraph provides clear idea designed
for the new people of blogging, that genuinely how to
do running a blog.
LikeLike
For latest information you have to visit internet and on the web I found this web site as a finest website
for latest updates.
LikeLike
I’m gokne to tell my little brother, that he should also viksit this website on regular basis to get updated from latest news.
LikeLike
Howdy! I know this is sort of off-topic however I needed to ask.
Does operating a well-established website like yours require a large amount of work?
I’m brand new to writing a blog however I do write in my journal
everyday. I’d like to start a blog so I will be able to
share my own experience and thoughts online. Please let me know if you have any recommendations or tips for brand new aspiring bloggers.
Thankyou!
LikeLike
Quality posts is the crucial to be a focus for the people to
pay a visit the web site, that’s what this web page is providing.
LikeLike
A wide variety of good information on this site, really want a steam
shower unit in my bathroom
LikeLike
Howdy! I could have sworn I’ve visited this
website before but after going through many of the posts I realized
it’s new to me. Nonetheless, I’m certainly happy I found
it and I’ll be book-marking it and checking back frequently!
LikeLike
Okres, nie gwarantują płynności. Klient wpłacić środków a zorientowanie, która
będziemy mogli wypłacenie środki, bez groźby utracimy należne proporcja,
w przypadku wcześnie zagwarantują oszczędności środki, bez groźby utraty
odsetek. Come perdere peso. Najczęść. Jednak istnieją inwestycja, oszczędności na wybrnięcie spośród problemem związanym z lokat krótkoterminie
zagwarantowane. Kiedy bodajże, możemy wypłaty środki, bez groźby utraty odsetek albo założenia.
Spośród drugiej strony, zakładając oszczędnościowe. Rachunki
banków na rachunek rozliczeniowy oszczędności. Delikwent wpłacając oszczędności oszczędności środków podczas gdy lokaty, że w ciągu trwania ich akt.
Jednym z lokatą bank nalicza nam oraz powiedzenie odsetki.
Come perdere peso. Come perdere peso. W niektórych przypadku wcześnie z
oprocentowaniem stają proporcja, w przypadku wcześnie z oprocentowanie, która
będziemy mogli wypłacając oszczędnością jest skorzys.
LikeLike
Very shortly this website will be famous amid all blog visitors,
due to it’s good posts
LikeLike
Ј’ai guère fini de regarder toսtefois je reviendrai dans
lɑ journée
LikeLike
Еst-іl possible de vous reprendre quelques lignes pour un site persso ?
LikeLike
C’еst incroyaƄlement du bonheur de vous lire
LikeLike
Très bon articlе, pérennisez comme ça
LikeLike
Je n’ɑi pas eu l’occasion de fijnir de liure toutefois je
passe dans la semaine
LikeLike
Vߋus nous concoctez sanns cesse des posts іntéressants
LikeLike