| View previous topic :: View next topic |
| Author |
Message |
vamsy
Joined: 21 Aug 2007 Posts: 60
|
Posted: Thu May 08, 2008 4:22 am Post subject: Web Service for sending Email in asp.net with c# |
|
|
hi experts,
i am developing a application which contains apart of sending email with the help web service. can any help how to send email. favor me for this context ASAP.
thanking you in advance.
with regards,
vamsy |
|
| Back to top |
|
 |
manoj
Joined: 21 Aug 2007 Posts: 102
|
Posted: Fri May 09, 2008 11:09 am Post subject: |
|
|
hi vamsy ,
here is the web method for sending email by using web service. web method is a method which can be consume by the client from client system by just giving web reference in Solution Explorer of visual studio frame work.
[WebMethod]
public string SendActivationEmail(string EmailID, string EmailActivationKey)
{
SmtpClient sc = new SmtpClient();
MailAddress From = new MailAddress("noreply@Test.com", "AndhraSMS.com");
MailAddress To = new MailAddress(EmailID, "*");
MailMessage mail = new MailMessage(From, To);
string BodyMessage = "Hello, \n";
BodyMessage = BodyMessage + " Thank you for registering on *.com. To activate your account.\n Enter the following code:";
mail.Body = BodyMessage + EmailActivationKey + "\n\n Sincerely, \n AndhraSMS Admin.";
mail.Subject = "*";
mail.Priority = MailPriority.High;
sc.Send(mail);
return "Sent Sucessfully";
}
try this code snippet . it will be help you a bit
enjoy the coding... |
|
| Back to top |
|
 |
vamsy
Joined: 21 Aug 2007 Posts: 60
|
Posted: Fri May 09, 2008 11:20 am Post subject: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavai |
|
|
hi,
i tried the code snippet but i can not able to send email. any one help me in this context situation. while sending email i am getting following error that
"System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable".
thanking you inadvance....
with regards,
vamsy |
|
| Back to top |
|
 |
muralikrishna
Joined: 21 Aug 2007 Posts: 36
|
Posted: Fri May 09, 2008 11:24 am Post subject: |
|
|
hi, you did not present exact code. but i'll solve your problem while sending email. it might be a factor. please put the smtp mail server credential in web.Config. in following section
<system.net>
<mailSettings>
<smtp>
<network host="mail.test.com" port="25" userName="smtp@test.com" password="*"/>
</smtp>
</mailSettings>
</system.net>
here port 25 is the default port for smtp.
try this . it may solve your problem in sending email.
keep on posting..... |
|
| Back to top |
|
 |
|