|
Do you have a SMTP mail server called localhost? You have to put in the actual IP address or name of your SMTP mail server to send mail.
Ben
|
|
|
|
|
Hi,
Replace your code with the following code and check your application:-
static string HostName = System.Net.Dns.GetHostName();
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add("mrk_hari@yahoo.com");
message.Subject = "This is the Subject line";
message.From = new System.Net.Mail.MailAddress("shkuricheti@gmail.com");
message.Body = "This is the message body";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(HostName);
smtp.Send(message);
Sandeep Kumar.V
|
|
|
|
|
Hi Sandeep,
Thankyou for the code, but it is giving the below error.
An established connection was aborted by the software in your host machine
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
Source Error:
Line 33: message.Body = "This is the message body";
Line 34: System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(HostName);
Line 35: smtp.Send(message);
Line 36:
Line 37:
Source File: c:\Inetpub\wwwroot\Phase1&2Backup23Mar\SendMail.aspx.cs Line: 35
Stack Trace:
[SocketException (0x2745): An established connection was aborted by the software in your host machine]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +200
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +60
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +579
[WebException: Unable to connect to the remote server]
System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +391
System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +288
System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +46
System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +429
System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +332
System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +287
System.Net.Mail.SmtpClient.GetConnection() +56
System.Net.Mail.SmtpClient.Send(MailMessage message) +1672
[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +2237
SendMail.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\Phase1&2Backup23Mar\SendMail.aspx.cs:35
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3038
How to resolve this.....
Thanks
Hari
-- modified at 2:20 Thursday 19th April, 2007
|
|
|
|
|
Hey why dont u reconfigure your SMTP sever which is there in IIS.
I think your Network is not allowing to run your SMTP Server
|
|
|
|
|
using System.Web.Mail;
private void SendMail(string TargetEmailAddress,string MessageBody)
{
MailMessage mailMsg = new MailMessage();
mailMsg.To = TargetEmailAddress;
mailMsg.From = "mail@mail.com";
mailMsg.Subject = "This is subject";
mailMsg.BodyFormat = MailFormat.Html;
mailMsg.BodyEncoding = Encoding.UTF8;
mailMsg.Body = MessageBody;
SmtpMail.Send(mailMsg);
return ;
}
We Can Do Anything, If We Want It
|
|
|
|
|
Try it like this. this is very simple.
string To = "cgodinez@technomex.net";
string From = "mymail@mail.com";
string Subject = "The Famous";
string Body = "Hello World";
SmtpMail.Send(From,To,Subject,Body);
We have to create an object (MailMessage) called myMail
MailMessage myMail = new MailMessage();
myMail.To = To;
myMail.Cc = "acarboncopy@cc.com";
myMail.From = From;
myMail.Subject = Subject;
myMail.BodyFormat = MailFormat.Html;
string body = "<html><body> Bolded message
<P>The Message</P> </body></html>";
myMail.Body = body;
myMail.Attachments.Add(new MailAttachment("c:\\filename.jpg"));
SmtpMail.Send(myMail);
Regards,
Satips.
|
|
|
|
|
hi friends
please tell me clear idea about datalist paging in ASP,C#.net.Already i refered lot of websites unfortunately, i didnot get clear idea about datalist paging
can anybody help me??
regards
saravanan
|
|
|
|
|
|
Dear Developers
I have integrated my Web App with Authorize.net AIM method. Now I want to store Transaction Number after successfull transaction.
I googled around for this but cudn't get the right solution for this. Please help me out...
Lets work it Out.........!
|
|
|
|
|
give me steps to create virtual directory in .net project.
thanks
|
|
|
|
|
Hi,
To create a new virtual folder in IIS, follow these steps:
1)Right-click the Default Web Site icon in IIS, and from the New menu click Virtual Directory
2)IIS starts the Virtual Directory Creation Wizard to walk you through creating a new virtual folder. Click Next on the wizard title page to display the Virtual Directory Alias page
3)Type an alias for the folder. The alias is name you will use to identify the resource in this folder. In Visual Studio .NET, this is the name you will use to specify the location of your project. Click Next. The wizard displays the Web Site Content Directory page
4)Type the path specification of the physical folder to associate with the virtual folder. This is the base folder where your project folders will be stored. Click Next. The wizard displays the Access Permissions page
5)Keep the default permissions. Click Next and then click Finish to create the virtual folder and end the wizard
Sandeep Kumar.V
|
|
|
|
|
hi, man its so easy. there is another and extremely easy.
Follow these steps.
1- make a new folder wher ever u want.
2- rename it.(whatever name u want to give it.)
3- rightclick the folder.
4- click sharing and security.
5- click web sharing.
6- fill the fields bellows.
thts it.
|
|
|
|
|
man...it's done manually...IMO, he means he want to create virtual directory thru code in .NET
<< >>
|
|
|
|
|
am using history.go() to go back to previous page on click of the back button .The problem is if i am adding something to the database and then going back with the back button the gridview is not getting updated since it is history page . so how can this be solved . How can i refresh the page.
pls help me out .
|
|
|
|
|
You mean you want to refresh the web page thru js?
<< >>
|
|
|
|
|
|
try window.reload(..), let me know if it works
<< >>
|
|
|
|
|
Hi i am using frameset in my page...,
In that frame set,one side i'm showing links,
if i click that links, in another html page my aspx page will be display...,
In that aspx page want to be adjust based on user property...,
It means,now i am using in that aspx page scroll tab...,
But with out scroll tab if i try to show some of the information on that page will be hide..,
But i want to show all information with out using scroll tab...,
How its possible plz help me...,
Magi
|
|
|
|
|
Still not got your clue...I think no problem currently how can user view the content withourt scrolling if the content exceed the web page???
<< >>
|
|
|
|
|
i m getting error:SERVER APPLICATION ERROR: while running any project in asp.net web application using .net 2003 version.
thanks
-- modified at 6:23 Wednesday 18th April, 2007
|
|
|
|
|
|
HI!
I have one quite short question. Does anybody know how instruct an update panel to update its context, without assigning a server side control(asp:Button) to do that.
|
|
|
|
|
You mean updating every an interval time?
<< >>
|
|
|
|
|
I need to do the following. Using ajax.net i create HttpRequest to the server, but with the difference that if server has no data for the client, the connection is not closed, but it is kept open. So when the data for the client arrives, the server can forward the data to the client. The data is just an id of the update panel that needs to update its content. So when the data arrives I need to instruct the specified update panel to update its content.
|
|
|
|
|
Hi
I currently have a form for people to fill in, with this they need to uplaod a profile picture of themselves. At the moment I have the following code which uploads the image, but i want to be able to resize the image to a certin size. Ive seen resizing help on the web, but most of these seem to be large/thumbnail codes and im getting a bit boggled!
Boolean fileOK = false;
String path = Server.MapPath("~/uploadedconsultantimages/");
if (UploadImage.HasFile)
{
String fileExtension =
System.IO.Path.GetExtension(UploadImage.FileName).ToLower();
String[] allowedExtensions =
{ ".gif", ".png", ".jpeg", ".jpg" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (fileExtension == allowedExtensions[i])
{
fileOK = true;
}
}
}
if (fileOK)
{
try
{
UploadImage.PostedFile.SaveAs(path
+ UploadImage.FileName);
FileUploaded.Text = "File uploaded!";
}
catch (Exception ex)
{
FileUploaded.Text = "File could not be uploaded.";
}
}
else
{
FileUploaded.Text = "Cannot accept files of this type.";
}
Any help would be appreciated. I working in c# .net2
Thanks
Adam
|
|
|
|