Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > My Messages Web part (Sending messages to multiple users) View modes: 
User avatar
Member
Member
Naresh - 12/28/2010 3:27:04 PM
   
My Messages Web part (Sending messages to multiple users)
Hi!

I am using the "My Messages" web part to manage the personal messages.
When I try to send a message to user, I can select only one recipient for a message.
Is their any way I can select multiple recipients for one message, so that I can send a single message to a group of my friends or users.
Can anyone please help me to sort this out.

Thank You,

Naresh

User avatar
Kentico Support
Kentico Support
kentico_radekm - 12/29/2010 1:07:58 AM
   
RE:My Messages Web part (Sending messages to multiple users)
Hello.

It is not supported by default, but you should be able to achieve requested behavior via some customization.

Control for sending messages (you have to customize) is placed in \CMSModules\Messaging\Controls\SendMessage.ascx.cs.

In btnSendMessage_Click method you can see 2 important variables: string nickName and int recipientId. According to them, proper UserInfo recipient and MessageInfo mi objects are created within btnSendMessage_Click method, and filled with proper data.

To achieve your goal, you would need to customize it, parse string from „txtFrom“ field and use the same logic as you can see in mentioned control/method for every user/object. This can be easily done in cycle.

Best Regards,
Radek Macalik

User avatar
Member
Member
Naresh - 12/29/2010 1:02:33 PM
   
RE:My Messages Web part (Sending messages to multiple users)
Hi!

Thank you Radek for the reply.
Apart from this, I also have another question related to this.
What if I want to send emails to a groups of my friends or other users, is there any web part to use?
For example, in a page I would like to place a web part, with which I want to send emails to group of my friends or other users.
Can you please let me know if there is any web part with these properties.

Thank You,

Naresh

User avatar
Kentico Support
Kentico Support
kentico_radekm - 12/30/2010 3:17:54 AM
   
RE:My Messages Web part (Sending messages to multiple users)
Hello.

Currently, we don´t have such a web part, but you can develop it yourself as custom web part (http://devnet.kentico.com/docs/devguide/developing_web_parts.htm).

Example of code you need for e-mail sending is this:

CMS.EmailEngine.EmailMessage em = new CMS.EmailEngine.EmailMessage();
em.EmailFormat = CMS.EmailEngine.EmailFormatEnum.Html;
em.From = "from@mail.com";
em.Recipients = "to@mail.com";
em.Subject = "Subject";
em.Body = "body of email";

CMS.EmailEngine.EmailSender.SendEmail("site_name", em);


Please make sure you have SMTP server specified in site settings for e-mails being sent properly.

There are two basic variations of SendEmail method:

CMS.EmailEngine.EmailSender.SendEmail(em);
//or
CMS.EmailEngine.EmailSender.SendEmail("site_name", em);
//you can use CMS.CMSHelper.CMSContext.CurrentSiteName for site name


The first one sends e-mail using global settings, while the second one sends e-mail using settings for specified site.

Best Regards,
Radek Macalik

User avatar
Member
Member
Naresh - 12/30/2010 10:23:45 AM
   
RE:My Messages Web part (Sending messages to multiple users)
Thank You Radek...