CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 .NET code for Sending Emails

Print topic Send  topic

Author Message
sgadson

Posts: 45
Posted: 04/04/2004, 4:00 PM

Hello,
I am looking for .NET VB code that will allow me to send emails to users when a task is assigned to them.

Please reply with detailed code.
_________________
Shawn :-)
View profile  Send private message
peterr


Posts: 5971
Posted: 04/04/2004, 4:19 PM

This is shown in our "Creating a Task Management System with the Application Builder" tutorial. Please look in the Help file or go through the tutorial online at http://docs.codecharge.com/studio/html/QuickStart/Creat...AppBuilder.html
The tutorial explains how to create a simple task management system and how to send emails to users when tasks are assigned to them. Looks like exactly what you asked for.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Jaro Steigauf
Posted: 04/07/2004, 4:19 AM

Here is my C# code (part for web app + source code)

regards

jaro


***********************
// web app
jsUtility.Mail.mailFrom =
jsUtility.Record.SeekOne("configuration_value","configuration","configuratio
n_key",

"MAIL_SERVER_EMAIL_FROM",FieldType.Text,Settings.Connection1DataAccessObject
).ToString();
jsUtility.Mail.mailTo = orderscustomers_email_address.Value;
jsUtility.Mail.mailCc = sMailToShop;
jsUtility.Mail.mailSubject =
jsUtility.Translation.TransText("Str","Order Confirm") + " : "
+ ordersorders_number.Value.ToString() + " / "
+ jsUtility.Shop.StoreNameCity();
jsUtility.Mail.mailPriority = "High";
jsUtility.Mail.mailBody =
jsUtility.Mail.ReadHtmlPage(Settings.ServerURL.TrimEnd(new
Char[]{'/'}) + "/" + Params0.ToString())
+ "<br><br>"+
jsUtility.Translation.TransText("Str","Thank you for your order.")
+ "<br><br>"+
"<a href='" + sWebSite + "'>" + sWebSite + "</a>";
jsUtility.Mail.SendMail();


****************************

//Source Code
// Start Mail Functions
public class Mail
{

public static string mailFrom = "";
public static string mailTo = "";
public static string mailCc = "";
public static string mailBcc = "";
public static string mailSubject = "";
public static string mailBody = "";
public static string mailBodyFormat = "Html";
public static string mailPriority = "High";

public static string MailServer()
{
// Return mail server from Configuration table
return
jsUtility.Record.SeekOne("configuration_value","configuration","configuratio
n_key",

"MAIL_SERVER",FieldType.Text,Settings.Connection1DataAccessObject).ToString(
);
}

public static bool SendMail()
{

bool ErrorFlag = false;
try {
SmtpMail.SmtpServer = jsUtility.Mail.MailServer();
MailMessage oMessage = new MailMessage();
switch (jsUtility.Mail.mailBodyFormat)
{
case "Text":
oMessage.BodyFormat = MailFormat.Text;
break;
case "Html":
oMessage.BodyFormat = MailFormat.Html;
break;
}
switch (jsUtility.Mail.mailPriority)
{
case "High":
oMessage.Priority = MailPriority.High;
break;
case "Low":
oMessage.Priority = MailPriority.High;
break;
}
oMessage.From = jsUtility.Mail.mailFrom;
oMessage.To = jsUtility.Mail.mailTo;
oMessage.Cc = jsUtility.Mail.mailCc;
oMessage.Bcc = jsUtility.Mail.mailBcc;
oMessage.Subject = jsUtility.Mail.mailSubject;
oMessage.Body = jsUtility.Mail.mailBody;
string sEmailUserId =
jsUtility.Record.SeekOne("configuration_value","configuration","configuratio
n_key",

"MAIL_SERVER_EMAIL_FROM_USER_ID",FieldType.Text,Settings.Connection1DataAcce
ssObject).ToString();
string sEmailPass =
jsUtility.Record.SeekOne("configuration_value","configuration","configuratio
n_key",

"MAIL_SERVER_EMAIL_FROM_PASSWORD",FieldType.Text,Settings.Connection1DataAcc
essObject).ToString();

if (sEmailPass != "" && sEmailUserId != "")
{

oMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauth
enticate", "1"); //basic authentication

oMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/senduser
name", sEmailUserId); //set your username here

oMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpass
word", sEmailPass); //set your password here
}

SmtpMail.Send(oMessage);
} catch {
ErrorFlag = true; }
return ErrorFlag;

}

public static string ReadHtmlPage(string url)
{
//read html page
string result;
WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()) )
{
result = sr.ReadToEnd();
sr.Close();
}
return result;
}


}
// End Mail Functions




"sgadson" <sgadson@forum.codecharge> wrote in message
news:84070937258fe3@news.codecharge.com...
> Hello,
> I am looking for .NET VB code that will allow me to send emails to users
when a
> task is assigned to them.
>
> Please reply with detailed code.
> _________________
> Shawn :-)
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


---
Odchadzajuca sprava neobsahuje virusy.
Skontrolované antivírusovým systémom AVG (http://www.grisoft.cz).
Verzia: 6.0.654 / Vírusová databáza: 419 - dátum vydania: 6. 4. 2004


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.