Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesSending email and massageSending email and massage
Previous
 
Next
New Post
5/17/2010 2:34 AM
 
Hi all..

I'm developing a custom module and I'm using DNN 5.4.1. I'm sending an email to the user but i want also  to send the same message to users message inbox on the portal. I know there is a messaging API, but can't find examples on how to use it. Can anybody help me with this? How to programmaticly send message to the user?
 

Alen
 
New Post
5/18/2010 8:53 AM
 
If anyone is interested to send message to another user here is how:

DotNetNuke.Services.Messaging.Data.Message inboxMessage = new DotNetNuke.Services.Messaging.Data.Message();
                inboxMessage.FromUserID = 1;
                inboxMessage.PortalID = PortalId;
                inboxMessage.Subject = "Message subject";                
                inboxMessage.Body = "Message Body";
                inboxMessage.EmailSent = false;
                inboxMessage.ToUserID = 5; //ID of the user to send messsage
                inboxMessage.Status = DotNetNuke.Services.Messaging.Data.MessageStatusType.Unread;
                inboxMessage.MessageDate = DateTime.Now;
                DotNetNuke.Services.Messaging.Data.MessagingDataService dnnMessaging = new DotNetNuke.Services.Messaging.Data.MessagingDataService();       
                long result = dnnMessaging.SaveMessage(inboxMessage);
                dnnMessaging.UpdateMessage(inboxMessage);
 
New Post
5/18/2010 9:00 AM
 
Useful, and here it is in VB.NET

Dim inboxMessage As New DotNetNuke.Services.Messaging.Data.Message()
inboxMessage.FromUserID = 1
inboxMessage.PortalID = PortalId
inboxMessage.Subject = "Message subject"
inboxMessage.Body = "Message Body"
inboxMessage.EmailSent = False
inboxMessage.ToUserID = 5
'ID of the user to send messsage
inboxMessage.Status = DotNetNuke.Services.Messaging.Data.MessageStatusType.Unread
inboxMessage.MessageDate = DateTime.Now
Dim dnnMessaging As New DotNetNuke.Services.Messaging.Data.MessagingDataService()
Dim result As Long = dnnMessaging.SaveMessage(inboxMessage)
dnnMessaging.UpdateMessage(inboxMessage)

Leigh Pointer
User Group Champion [World Wide]
» Evangelising DotNetNuke Everywhere «

Nederlandstalige DotNetNuke Gebruikersgroep Subzero Solutions ARC for DotNetNuke Design is the craft of visualising concrete solutions that serve human needs and goals within certain contraints. Visulising concrete solutions is the essence of design.
 
New Post
9/24/2010 10:30 AM
 
How can I send an html mail ?

thanks
 
New Post
9/24/2010 11:09 AM
 
It does not appear from the Messaging API nor from the Messaging module code that there are any restrictions on what content is passed in the Body property of the Message. There are no properties that need to be set to specify that the Body contains text only or HTML content (unlike the SendMail API). Accordingly it would appear that any HTML markup which is included in the Body will be sent and displayed to the recipient user.

I would caution that if you are not using the DNN text editor control which will automatically HtmlEncode markup that you will need to consider the security implications of passing raw HTML content through the Messaging API and sanitize it appropriately before saving.

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesSending email and massageSending email and massage


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out