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

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Looking for help with building a simple send email moduleLooking for help with building a simple send email module
Previous
 
Next
New Post
1/20/2014 8:58 PM
 
i know this should be posted in the forage section but I know more people read this section. I am new to developing a module using Module Creator. I want to build a simple module, first then add a jquery select statement after I get the first easy module created. I already have the Jquery part of it created. So here is what I would like it to look like:

Send Email To: [Text Field Here]
Email Sent From: [Text Field Here]
Subject: [Text Field Here]
Message: [Multiline Text Field Here]
[Submit Button Here]

I know how to write the script for the above so that is not a problem. What I don't know how to do is the rest. I have searched all over and can not find any info on it. So here are my questions:

1. in the module creator language should I use C# , VB , or Web?

2. if you have a basic View.ascx View.ascx.resoce and/or a View.ascx.CS code I can copy to get me going I would appreciate it.

3. Any info on tutorials, or links would be greatly appreciated!

4. Am I asking for a lot of help here?
 
New Post
1/21/2014 4:48 AM
 
Well I figured out the first part using C# and rad script it is as follows (for anyone else that is trying to do it:
@using DotNetNuke.Common;

@*Copyright (c) 2014 by Scott *@


@{
var errorMessage = "";

if (IsPost)
{
var toEmail = Request["toEmail"];
var fromEmail = Request["fromEmail"];
var subject = Request["subject"];
var body = Request["body"];

try {
WebMail.SmtpServer = "relay-hosting.secureserver.net";
WebMail.SmtpPort = 25;

WebMail.UserName = "Name admin@whatever.com";
WebMail.Password = "Password";
WebMail.From = fromEmail;
WebMail.Send(to: toEmail,
subject: subject,
body: body);
}
catch (Exception ex ) {
errorMessage = ex.Message;
}
}
}



< form method="post">
From Address: < input type="text" name="fromEmail" value="Admin@Whatever.com" size="65"/>
< Br>
< Br>
To Address:     < input type="text" name="toEmail" size="65" />
< Br>
< Br>
Subject:           < input type="text" name="subject" value="An update from Me" size="65"/>
< Br>
< Br>
Body:               < textarea id="body" Name="body" cols="60" rows="10">< /textarea>
< Br>
< Br>
                       < input id="Submit1" type="submit" value="Send Email" />
< /form>








 
New Post
1/21/2014 4:50 AM
 
My next questions are:

How and where would I add a site redirect after pressing the send email button?

How would I add a sql select script into the To: field (with a drop down menu) here is the script I have set up:SELECT 'All Users' as QuestionOption, Stuff( (SELECT N'; ' + email FROM users where email>=' ' FOR XML PATH(''),TYPE) .value('text()[1]','nvarchar(max)'),1,2,N'') as QuestionOptionValue UNION SELECT 'All Volunteers' as QuestionOption, Stuff( (SELECT N'; ' + U.email FROM dbo.Users AS U LEFT OUTER JOIN (SELECT up.UserID, MAX(CASE WHEN ppd.PropertyName = 'Volunteer' THEN up.PropertyValue ELSE '' END) AS Volunteer FROM dbo.UserProfile AS up INNER JOIN dbo.ProfilePropertyDefinition AS ppd ON up.PropertyDefinitionID = ppd.PropertyDefinitionID and ppd.PortalID = 0 Group By up.UserID) as upd on U.UserID = upd.UserID Where upd.Volunteer='True' FOR XML PATH(''),TYPE) .value('text()[1]','nvarchar(max)'),1,2,N'') as QuestionOptionValue UNION
SELECT 'All Committees' as QuestionOption, Stuff( (SELECT N'; ' + U.email FROM dbo.USERS AS U LEFT OUTER JOIN (SELECT up.UserID, MAX(CASE WHEN ppd.PropertyName = 'Committee' THEN up.PropertyValue ELSE '' END) AS Committee FROM dbo.UserProfile AS up INNER JOIN dbo.ProfilePropertyDefinition AS ppd ON up.PropertyDefinitionID = ppd.PropertyDefinitionID and ppd.PortalID = 0 Group By up.UserID) as upd on U.UserID = upd.UserID Where upd.Committee >' ' FOR XML PATH(''),TYPE) .value('text()[1]','nvarchar(max)'),1,2,N'') as QuestionOptionValue
 
New Post
1/21/2014 6:38 AM
 
For starters - you should never add a
Instead of going down the path you are attempting to use - use the Create Module tool to build a default c# module - not a razor script module.

The c# module template will set you up a default that shows you how to add fields and how to include an clickable button - that responds on the server side in a way that can easily be used to do you send mail code.

Westa

 
New Post
2/7/2014 3:52 AM
 

Hi!

I have a same goal. How I wanted to decide it:

1.Add to page simple HTML/text module. Some forms with button.

2. Add some scripts before and/or after content of module.

3. Result: when I press on the button a email with information from forms is sending to test@test.ru

A question is - can I realize such scheme? And how? Or I need to create new type of module?

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Looking for help with building a simple send email moduleLooking for help with building a simple send email module


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