|
try
{
string msgBody = "";
string configToAddresses = "";
string[] toAddressesArray;
configToAddresses = ConfigurationManager.AppSettings["MSG_REQUEST_TO_EMAIL_ADDRESS"].Trim();
MailMessage msg = new MailMessage();
msg.From = new MailAddress(ConfigurationManager.AppSettings["MSG_REQUEST_FROM_EMAIL_ADDRESS"].Trim());
toAddressesArray = configToAddresses.Split(';');
// Add to Addresses in email
foreach (string toAddress in toAddressesArray)
{
msg.To.Add(new MailAddress(toAddress));
}
if (ConfigurationManager.AppSettings["MSG_REQUEST_CC_EMAIL_ADDRESS"].Trim().Length > 0)
{
msg.CC.Add(new MailAddress(ConfigurationManager.AppSettings["MSG_REQUEST_CC_EMAIL_ADDRESS"].Trim()));
}
msg.Subject = ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_SUBJECT"].Trim() + " " + DateTime.Now;
msgBody = ConfigurationManager.AppSettings["MSG_REQUEST_SALUTE_EMAIL"].Trim() + "\r\n\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_BODY_START"].Trim() + " " + this.txtName.Text.Trim() + " (" + this.txtEmail.Text.Trim() + ")";
if (this.txtOrganization.Text.Trim().Length > 0)
{
msgBody += " of " + this.txtOrganization.Text.Trim();
}
msgBody += " on " + DateTime.Now + ". ";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_BODY_MIDDLE"].Trim() + "\r\n\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_URL"].Trim() + "\r\n\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL"].Trim() + "\r\n\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_TEAM"].Trim() + "\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_TEAM_URL"].Trim();
msg.Body = msgBody;
SmtpClient client = new SmtpClient();
client.Host = ConfigurationManager.AppSettings["SMTP_HOST"];
client.Port = int.Parse(ConfigurationManager.AppSettings["SMTP_PORT"]);
client.Send(msg);
}
catch (System.Threading.ThreadAbortException ex) { }
catch (Exception ex)
{
ConfigurationManager.AppSettings["DEFAULT_MESSAGE"] = ex.ToString();
Response.Redirect("Message.aspx");
}
Regards, Qaiser Nadeem
|
|
|
|
|
Sir the code u sent me is it running properly i mean.
Will i have to make any changes in web.config file
If yes plz let me know I'm waiting for response by ur side
|
|
|
|
|
yes, yes, its working properly, but you have to define the msgs in web.config
Regards, Qaiser Nadeem
|
|
|
|
|
should i send u the web msgs????
Regards, Qaiser Nadeem
|
|
|
|
|
yes plz send the web.config code too
|
|
|
|
|
<add key="MSG_REQUEST_EMAIL_SUBJECT" value="New MTAP Travel Request Added on">
<add key="MSG_REQUEST_SALUTE_EMAIL" value="Dear Administrator,">
<add key="MSG_REQUEST_EMAIL_BODY_START" value="A new travel request has been added on the MTAP Travel web site by">
<add key="MSG_REQUEST_EMAIL_BODY_MIDDLE" value="Please go to the following URL and log in to see the newly added travel request:">
<add key="MSG_REQUEST_FROM_EMAIL_ADDRESS" value="qnadeem@iengineering.com">
<add key="MSG_REQUEST_TO_EMAIL_ADDRESS" value="qnadeem@iengineering.com">
<add key="MSG_REQUEST_CC_EMAIL_ADDRESS" value="q.nadeem@hotmail.com">
<add key="MSG_REQUEST_SIGNATURE_EMAIL" value="Thank you,">
<add key="MSG_REQUEST_SIGNATURE_EMAIL_URL" value="URL: http://www.define your own web page.com">
<add key="MSG_REQUEST_SIGNATURE_EMAIL_TEAM" value="MTAP Travel Team">
<add key="MSG_REQUEST_SIGNATURE_EMAIL_TEAM_URL" value="http://dev.travel.mtap.org">
if u still have any questions then plz come on q.nadeem@hotmail.com
Regards, Qaiser Nadeem
|
|
|
|
|
How to get the SMTP server of the system
Thnx in advance
|
|
|
|
|
Open the IIS then check for Default SMTP server name if you are able to see Stop
button then it is running or if it is in stop mode then try to start it
Are you tring this at your home machine or you are in some organization
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
I'm trying this in my Office and I'm using ASP.NET 1.1 with c#
|
|
|
|
|
Many organization stops the Default SMTP server and will not allow you to send any mail due to organizational policies
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
For configuring the SMTP server you have to follow the steps given below:
Go to>Start Menu>Control Panel>Administrator Tools>Internet Information Services.
Click the Internet Information Services and locate the Default SMTP Virtual Server.
If you have the rights to go try itin ur office .
If it is ur own PC means try as i said.
Regards,
Satips.
|
|
|
|
|
Continue in the Same thread.
BTW why are you creating the New thread.?
Regards,
Satips.
|
|
|
|
|
I am new in ASP can I got the problem in the login form with sql server databas
can any one told me How can i resolve this problem . My code is givin below.
<%
sql = "select * from login where u_id = '" & uname& "' AND pwd = '" &passwd& "'"
'response.Write(sql)
'response.End()
Set rst = Server.CreateObject("Adodb.Recordset")
rst.Open sql, conn, 3, 3
'username=rst("u_id")
'password=rst("pwd")
'response.Write(username)
'response.Write(password)
'response.End()
Its Work correctly from here. But when i write code below. I mense if condition it can not be work.
If rst.EOF and rst.BOF then
msg = "Wrong Entry ! please try again"
Response.redirect "index.asp"
Response.End()
Else
session("UserId")=Rs("uname")
msg =""
Response.redirect "AdminIndex.asp"
Response.end
End If
%>
Regard's
Kaushik
|
|
|
|
|
Y_Kaushik wrote: I got the problem in the login form with sql server databas
What error?
Regards,
Satips.
|
|
|
|
|
Before if statement code work correctly but
When i try to compare login info with database. its if statement is not redirect the page
If rst.EOF and rst.BOF then
msg = "Wrong Entry ! please try again"
Response.redirect "index.asp"
Response.End()
Else
session("UserId")=Rs("uname")
msg =""
Response.redirect "AdminIndex.asp"
Response.end
End If
I don't think above code is where wrong . The if statement is not work corectly.
Regard's
Kaushik
|
|
|
|
|
Put break point and check the code whether it is displaying the User name or not.
Regards,
Satips.
|
|
|
|
|
Probably the problem i have that it is ASP.NET forum and many of the users don;t knoe ASP
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
i've got a ReportViewer object on my aspx page, which prints out invoice documents.. i use series of pages, size of 9,5x5,5inch.. when i try to print out, it prints the data of two pages in one page with small fonts and ejects the second page emptyly.. on the ReportServer project, in preview mode, i can print out the data normally. what is wrong with it? thnks for your help..
|
|
|
|
|
adamoz wrote: what is wrong with it?
How can we say without seeing your code.
Regards,
Satips.
|
|
|
|
|
i think the problem is not in code.. but i dont know where it is
//in .aspx page
<rsweb:reportviewer id="rvReport1" runat="server" processingmode="Remote"
="" width="980px" height="620px">
///***in codebehind
private void Page_Init(object sender, EventArgs e)
{
ConfigureReportServer();
}
private void ConfigureReportServer()
{
string REPORT_SERVER_URL = "REPORT_SERVER_URL";
string Report_Username = "..";
string Report_Password = "..."
StringBuilder sb = new StringBuilder();
string[] sIndexes = Request.QueryString["sIndexes"].Split(',');
for (int i = 0; i < sIndexes.Length; i++)
{ sb.Append(sIndexes[i]+Environment.NewLine);}
System.Net.CredentialCache cc = new System.Net.CredentialCache();
Microsoft.Reporting.WebForms.IReportServerCredentials irsc = new CustomReportCredentials(Report_Username, Report_Password, "");
rvReport1.ServerReport.ReportServerCredentials = irsc;
rvReport1.ServerReport.ReportServerUrl = new System.Uri(REPORT_SERVER_URL);
while (rvReport1.ServerReport.IsDrillthroughReport)
{
rvReport1.PerformBack();
}
string strReport = "/InvoicePrint";
rvReport1.ServerReport.ReportPath = strReport;
Microsoft.Reporting.WebForms.ReportParameter[] Parametre = new Microsoft.Reporting.WebForms.ReportParameter[1];
Parametre[0] = new Microsoft.Reporting.WebForms.ReportParameter("sIndexes", sb.ToString());
rvReport1.ServerReport.SetParameters(Parametre);
rvReport1.ServerReport.Refresh();
}
|
|
|
|
|
Hi All,
I want to include a feature in the Intranet application that I develop which allows the client to use the application only for a specified period and then requires some activation from the developer's side before the client can continue using the application i.e. similar to the trial versions of dektop applications which require purchase of licenses after the expiry of the trial period.
Is it possible with an Intranet application? If yes, can you provide some references to implement the same?
Thanks
|
|
|
|
|
Hello Everyone,
I'm try to send email on the net.
The coding i've used is given below. This piece of code is just generating the message "Message Sent Successfully" but not sending the message physically
This code of piece is clicked over a Button
MailMessage mail=new MailMessage();
mail.To="manoj.manojbisht@gmail.com";
mail.From="msb1984_620@yahoo.com";
mail.Subject="Manoj Bisht";
mail.Priority=MailPriority.High;
mail.Body="I Love U Do You Love Me";
try
{
SmtpMail.SmtpServer="";
SmtpMail.Send(mail);
//Response.Write("Mail Sent Successfully");
lblMsg.Text="Mail Sent Succesffully";
lblMsg.ForeColor=Color.DarkBlue;
}
catch(Exception ex)
{
Response.Write("Message Failed");
}
|
|
|
|
|
Did you check the Norton is Blocking or not.
Regards,
Satips.
|
|
|
|
|
Are you using VS 2005
if yes then you have new namespace called System.Net.Mail
USe that i think you don;t have SMPT server at your machin in running state
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Sandeep Akhare wrote: Systtem.Net.Mail
It is System.Net.Mail.
Correct your Spelling Sandeep.
Regards,
Satips.
|
|
|
|