Sending email using mojoportal.net dll's function

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/22/2009 11:55:11 PM
Gravatar
Total Posts 10

Sending email using mojoportal.net dll's function

I have created my own usercontrol .

in which on button click i want to send email .

is there any solution or any functionality in portal avilabel.

3/23/2009 7:15:02 AM
Gravatar
Total Posts 18439

Re: Sending email using mojoportal.net dll's function

Hi,

If you are working with the mojoPortal source code you can find code examples for almost anything you need to do. For an example of email code you can look at the contact form or the blog (which sends comment notification), or the forums which send notifications.

Study the existing code and you will find answers how to do many things.

Hope it helps,

Joe 

3/31/2009 12:44:15 AM
Gravatar
Total Posts 10

Re: Sending email using mojoportal.net dll's function

i have created one usercontrol in which i have number of textboxes and one submit button.

i want to send the value of text boxes via mail on click of submit button

i have write this code

MailMessage oMessage = new MailMessage();
oMessage.From = new MailAddress("");
oMessage.To.Add("");
oMessage.Subject = "hi";
oMessage.Body = "hi";
oMessage.IsBodyHtml = true;
SmtpClient osmtpclient = new SmtpClient();
osmtpclient.Send(oMessage);
try
{
osmtpclient.Send(oMessage);
//Response.Redirect("Contact-Us.aspx");
}
catch (System.Net.Mail.SmtpException se)
{
Response.Write(se.Message);
}
finally { osmtpclient = null; oMessage = null; }

so it gives this exception

i am using mojoportal

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

 

3/31/2009 6:36:48 AM
Gravatar
Total Posts 18439

Re: Sending email using mojoportal.net dll's function

You did not set any properties on the SmtpClient so it can't relay mail, youhave to specify lots of settings like server, username, password port etc..

mojoPortal has some built in stuff to make sending email a little easier. If you study the mojoPortal source code you can find examples of almost anything you want to do.

This example comes from the ContactForm feature:

try
{
Email.SendEmail(
SiteUtils.GetSmtpSettings(),
siteSettings.DefaultEmailFromAddress,
txtEmail.Text,
Settings["ContactFormEmailSetting"].ToString(),
string.Empty,
string.Empty,
subjectPrefix + ": " + this.txtSubject.Text,
message.ToString(),
true,
"Normal");


}
catch (Exception ex)
{
log.Error(ex);
}

 

}

Hope it helps,

Joe

 

4/1/2009 5:23:48 AM
Gravatar
Total Posts 10

Re: Sending email using mojoportal.net dll's function

what exactly "mojoportal source code" means??

4/1/2009 6:09:59 AM
Gravatar
Total Posts 18439

Re: Sending email using mojoportal.net dll's function

If you look at the the download page and read it, it tells you about the different files. "release" files are pre-compiled and have no C# source code, "sourcecode" is the package with the source code including Visual Studio solution .sln file.

"Release" files are meant for deployment on production. "Source Code" is meant for developers to be able to compile their own package of mojoPortal and to study to understand how mojoportal works and so developers can more easily build custom features.

Hope it helps,

Joe

4/3/2009 4:29:37 AM
Gravatar
Total Posts 10

Re: Sending email using mojoportal.net dll's function

thax joe .

i got the solution.

You must sign in to post in the forums. This thread is closed to new posts.