|
i have used this code for sending mail . code was successfully running but msg was not sent to the client. i have using this below information.
To yogesh_softworld@yahoo.co.in
From yogeshdewangan97@gmail.com
SMTP Server 66.249.89.19 (gmail server ip)
SMTP User 127.0.0.1 (local host)
SMTP Pass archana123
Subject test email
Body abcabcabc.........................bc
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// This tutorial is provided in part by Server Intellect Web Hosting Solutions http://www.serverintellect.com
// Visit http://www.AspNetTutorials.com for more ASP.NET Tutorials
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
MailMessage message = new MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text);
SmtpClient emailClient = new SmtpClient(txtSMTPServer.Text);
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(txtSMTPUser.Text, txtSMTPPass.Text);
emailClient.UseDefaultCredentials = false;
emailClient.Credentials = SMTPUserInfo;
emailClient.Send(message);
litStatus.Text = "Message Sent";
}
catch (Exception ex)
{
litStatus.Text=ex.ToString();
}
}
}
then an exception was occured
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at _Default.btnSubmit_Click(Object sender, EventArgs e) in e:\Yatra\Default.aspx.cs:line 32
wht can i do????
pls help me sir
yogesh
|
|
|
|
|
For goodness' sakes man, edit your message and remove your gmail password.
|
|
|
|
|
sir,
thank u for solution, but i am not understanding wht u r saying, so plz detailed me entire problem, it is very urget sir, i am trying with my full effort but i do not able to do that yet. plz sir wht can i do, my project submission date is about to come, plz sir heip me. i m very sirious,
adv thank you sir..................
yogesh
|
|
|
|
|
I do not have a solution (except that
SMTP Server 66.249.89.19 (gmail server ip)
SMTP User 127.0.0.1 (local host)
Looks odd to me - 127.0.0.1 is your local host, not a user)
I am just saying that you have posted your gmail username adn password in your post, and anyone can log in and use your account there using them. I suggest you edit your original post and remove your password from it. (Click the Modify link at the bottom of it)
|
|
|
|
|
dear sir. i am using this code for sending email, i think this code will be aid to thinking u.
MailMessage message = new MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text);
SmtpClient emailClient = new SmtpClient(txtSMTPServer.Text);
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(txtSMTPUser.Text, txtSMTPPass.Text);
emailClient.UseDefaultCredentials = false;
emailClient.Credentials = SMTPUserInfo;
emailClient.Send(message);
litStatus.Text = "Message Sent";
}
catch (Exception ex)
{
litStatus.Text=ex.ToString();
}
thank u sir.
yogesh
|
|
|
|
|
try setting the smtp.Port to 465 before sending
emailClient.Port = 465;
and see if that helps.
Fred
|
|
|
|
|
Hello Sir/Mam,
Please let me know how to build up a search engine in ASP.NET....
sandeephs
|
|
|
|
|
|
No need to develop the search engine by coding
Now question is how will you have the search engine
Totally depends on you what you have search there are n numbers of Search engines are avialable those are free and extendable so depending on your requirement you can get simply you need to add those dll add use there methods
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... "
|
|
|
|
|
when i try print the report from CrystalReportViewer , show error message (
Error in File C:\WINDOWS\TEMP\picklist {3EDF8C64-E9DE-4E24-9F43-2590B5CFE8B4}.rpt: Operation not yet implemented.
)
123
|
|
|
|
|
|
hi ,
how can i add and delete and update with one gridview in ASP.NET and my database is SQL 2005???
abbas hassan
from Bahrain
thanks...
|
|
|
|
|
|
Hi,
I have an ASP.NET web application where I am fetching around 15000 records (only one column) from a database (SQL Server). I want to store the values in a comma separated string.
Currently I have set up dataset for the job but it is taking a lot of time to fetch records. What can be done to improve the same?
Thanks,
HR
|
|
|
|
|
Is the SQL Database server on the same machine as the ASP.NET webpage? If not, you may be able to speed it up by putting both on the same server.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Hi,
The database is on a different server. Since it is a project for a client, I don't have permissions to move the database and ASP.NET application on the same server.
HR
|
|
|
|
|
1. Use a data reader directly instead of putting everything in a data set before using it.
2. Use a StringBuilder to create the string.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
How to encrypt password with salt using T-SQL for inserting into aspnet_Membership?
|
|
|
|
|
i am loading values of submenuitem from database at run time. now i want to store that selected submenuitem value for transferring to next page.can you suggest me how can i capture the value of selected submenuitem.
i am developing my website in visual studio2005
|
|
|
|
|
Hi all,
I would like to post some data in the form of XML to a ceratin URI.
I have a method like this
HttpPost(URL, xmlOut);
xmlout is a string parameter looks like :-
*********************************
<message_delivery>
<authentication>
<user_name>uname</user_name>
<password>password</password>
</authentication>
<test id="1178028363209" redelivered="false" test="false">
<rb_message>
<recipient id="348">1</recipient>
</rb_message>
<rb_message>
<recipient id="349">2</recipient>
</rb_message>
</message_delivery>
************************************************
In the method i have the following code that generates an error message :
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URI);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
strNewValue = "XML=" + xmlout;
req.ContentLength = strNewValue.Length;
StreamWriter stOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
stOut.Write(strNewValue);
stOut.Close();
byte[] lbPostBuffer = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(strNewValue);
Stream loPostData = req.GetRequestStream();
loPostData.Write(lbPostBuffer,0,lbPostBuffer.Length);
loPostData.Close();
ERROr : It generates error Message that it can't write on
(loPostData.Write(lbPostBuffer,0,lbPostBuffer.Length);
ERROR :
The request was aborted: The connection was closed unexpectedly.
Please advice
Thanks
-- modified at 11:27 Thursday 18th October, 2007
|
|
|
|
|
You haven't url encoded the data.
strNewValue = "XML=" + Server.UrlEncode(xmlout);
Why are you writing the data twice, with different encodings?
The ContentLength is in bytes, not characters, which will differ depending on encoding. What encoding will you be using?
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Thanks very much
I would like to use XML encoding.Its only that i didnt comment that out.otherwise, i am using one of them.
I have tested changing this strNewValue = "XML=" + Server.UrlEncode(xmlout);
However it says :
The request was aborted: The connection was closed unexpectedly.
Thanks
|
|
|
|
|
kibromg wrote: I would like to use XML encoding.
XML is not an encoding. ASCII and UTF-8 are examples of encodings.
kibromg wrote: The request was aborted: The connection was closed unexpectedly.
That is probably because the content length value that you set in the header doesn't match up with the data that you send.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Thanks i am using ("UTF-8) for encoding as in the following code.
Encoding enc = System.Text.Encoding.GetEncoding("UTF-8");
byte[] lbPostBuffer = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(strNewValue);
Stream loPostData = req.GetRequestStream();
loPostData.Write(lbPostBuffer,0,lbPostBuffer.Length);
loPostData.Close();
However, i still have the error message.
-- modified at 13:15 Monday 22nd October, 2007
|
|
|
|
|
kibromg wrote: Encoding enc = System.Text.Encoding.GetEncoding("UTF-8");
You can use the System.Text.Encoding.UTF8 property to get the encoding instead of creating one from a string identifier.
kibromg wrote: byte[] lbPostBuffer = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(strNewValue);
Why on earth do you create another encoding instread of the one that you created on the previous line?
kibromg wrote: However, i still have the error message.
Do you assign the length of the byte array to the ContentLength?
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|