Contributed by : Pinky Bhadran
Q.What is the namespace used for sending mail?
Answer: System.net.mailQ.Write the code for sending asynchronous mail?
Answer: public void SendAsyncMail()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("Enter from mail address");
mail.To.Add(new MailAddress("Enter to address #1"));
mail.To.Add(new MailAddress("Enter to address #2"));
mail.Subject = "Enter mail subject";
mail.Body = "Enter mail body";
SmtpClient smtpClient = new SmtpClient();
Object state = mail;
//event handler for asynchronous call
smtpClient.SendCompleted += new
SendCompletedEventHandler(smtpClient_SendCompleted);
try
{
smtpClient.SendAsync(mail, state);
}
catch (Exception ex)
{
}
}
void smtpClient_SendCompleted(object sender,
System.ComponentModel.AsyncCompletedEventArgs e)
{
MailMessage mail = e.UserState as MailMessage;
if (!e.Cancelled && e.Error!=null)
{
message.Text = "Mail sent successfully";
}
}
Q.What is the transport protocol you use to call a web service?
Answer: SOAP(Simple object Access Protocol)
Q.A web server can only be written in .net?(True/False)
Answer: False
Q.What does Wsdl stands for?
Answer: Web Service Description Language
http://wiki.asp.net/page.aspx/536/send-asynchronous-mail-using-aspnet/
blogs.sitepoint.com/sending-web-email...
Contributed by : Saravana Kumar
Q. How do I send email message from ASP.NET ?
Answer: ASP.NET provides two namespaces System.WEB.mailmessage class and System.Web.Mail.Smtpmail class.
Reference:
http://www.aspheute.com/english/20000918.asp
http://www.4guysfromrolla.com/articles/072606-1.aspx
http://interview.fyicenter.com/1758_.NET_ASP.NET_How_do_I_send_email_message_from_ASP.NET.html
http://www.aspfree.com/c/a/ASP-Code/Send-Email-using-ASPNET-formatted-in-HTML/
Q. How to send e-mail from an ASP.NET application?
Answer: # 1 MailMessage message = new MailMessage ();
message.From = <email>;
message.To = <email>;
message.Subject = "Scheduled Power Outage";
message.Body = "Our servers will be down tonight.";
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send (message);
MailMessage and SmtpMail are classes defined in the .NET Framework Class Library's System.Web.Mail namespace.Due to a security change made to ASP.NET just before it shipped, you need to set SmtpMail's SmtpServer property to "localhost" even though "localhost" is the default.In addition, you must use the IIS configuration applet to enable localhost (127.0.0.1) to relay messages through the local SMTP service.
Reference :
http://www.developer.com/net/asp/article.php/3096831/Using-ASPNET-To-Send-Email.htm
http://www.aspheute.com/english/20000918.asp
http://www.allinterview.com/showanswers/23045.html
Q.Write the HTML for a hyperlink that will send mail when the user clicks the link?
Answer:
<a href="mailto:you@pragim.com?SUBJECT=Sending from a client&BODY=Some message text."> Send mail </a>
Reference :
http://programming.top54u.com/post/HTML-Email-Hyperlink-href-mailto.aspx
http://www.blurtit.com/q887234.html
Contributed by : Majesh .S
Q.Define SMTPclient class in DotNet framework class library?
Answer:
Each classes in dotnet framework include some properties,method and events.These properties ,methods and events are member of a class.SMTPclient class mainly concern with sending mail.This class contain the following member.
Properties:-
Host:-The name or IP address of email server.
Port:-Port that is use when sending mail.
Methods:-
Send:-Enables us to send email synchronously.
SendAsynchronous:-Enables us to send an email asynchronously.
Event:-
SendCompleted:-This event raised when an asynchronous send opertion completes
No comments:
Post a Comment