| Author: Narayanan Sukumaran 03 Oct 2008 | Member Level: Gold Points : 1 |
I have tried the above code, but i got namespace error message. I tried to attach the below DLL, but it is not there.
using System.Web.UI.WebControls.WebParts; using System.Net.Mail;
Please guide me on this?
|
| Author: Meetu Choudhary 03 Oct 2008 | Member Level: Gold Points : 1 |
Mr. Narayanan Sukumaran I have attached the files here please check them and try.. then let me know
-- Thanks and Regards Meetu Choudhary
|
| Author: sheetal jagdale 04 Oct 2008 | Member Level: Silver Points : 2 |
Yes ,This is working. Thanx , How to attached some file with this ?? & if i want to send same mail to some say 5000 people ,where the email addresses comes from database (sql server2005),how i will do this ?? how much time it takes to send mail to 5000 people ??
Pl.answer
Thanx anyway sheetal
|
| Author: sheetal jagdale 04 Oct 2008 | Member Level: Silver Points : 2 |
Yes ,This is working. Thanx , How to attached some file with this ?? & if i want to send same mail to some say 5000 people ,where the email addresses comes from database (sql server2005),how i will do this ?? how much time it takes to send mail to 5000 people ??
Pl.answer
Thanx anyway sheetal
|
| Author: Meetu Choudhary 04 Oct 2008 | Member Level: Gold Points : 2 |
Hi, sheetal ji
If you want to send it to the more then one people then you can use cc and bcc list it is already implemented in the function u just have to fetch the list from the database and then you can pass that comma separated string to the cc or bcc parameter...
-- Thanks and regards Meetu Choudhary
|
| Author: Babu 20 Oct 2008 | Member Level: Bronze Points : 1 |
Hi All, Can you send the code for sending mail in ASP.NET using VB. Please it’s very urgent. Now I’m Begging level for developing the website. So please send the code as soon as possible
|
| Author: Meetu Choudhary 21 Oct 2008 | Member Level: Gold Points : 2 |
Mr. Babu
Please Try This and Let Me know if any problems
Imports System Imports System.Data Imports System.Configuration Imports System.Collections Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Imports System.Net.Mail
Public Partial Class [Default] Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) 'Calling the function SendMail Response.Write(SendMail("meetuchoudhary@gmail.com", "meetudmeet@gmail.com", "meetudmeet@yahoo.com", "Test Mail", "Test Mail Body")) End Sub
Public Function SendMail(ByVal toList As String, ByVal from As String, ByVal ccList As String, ByVal subject As String, ByVal body As String) As String Dim message As New MailMessage() Dim smtpClient As New SmtpClient() Dim msg As String = String.Empty Try Dim fromAddress As New MailAddress(from) message.From = fromAddress message.[To].Add(toList) If ccList <> Nothing AndAlso ccList <> String.Empty Then message.CC.Add(ccList) End If message.Subject = subject message.IsBodyHtml = True message.Body = body smtpClient.Host = "mail.server.com" smtpClient.Port = 25 smtpClient.UseDefaultCredentials = True smtpClient.Credentials = New System.Net.NetworkCredential("info@server.com", "password")
smtpClient.Send(message) msg = "Successful" Catch ex As Exception msg = ex.Message End Try Return msg End Function
End Class
== Thanks and Regards Meetu Choudhary
|
| Author: Gaurav Arora 31 Oct 2008 | Member Level: Gold Points : 2 |
Hi Meetu!
All above is great I must appreciate you for that. One more thing, If I am not wrong then we also can send the mail using Stored Proc. If yes, then why should we go for that much heavy coding. With the use of SQL we can mange the same very well.
Hope you are agree with me.
Thansk & regards, Gaurav Arora
|
| Author: Meetu Choudhary 31 Oct 2008 | Member Level: Gold Points : 1 |
Hi Gaurrav,
Yes i do agree with you but what if in some sites we do not use datbases and still we want to send feebacks or other stuff for this only need i don't think that we must go for database and stored procedures.
Hope you too agree with me
++ Thanks nd Regards Meetu Choudhary
|
| Author: Pradeep Y 31 Oct 2008 | Member Level: Gold Points : 0 |
I DISAGREE WITH YOU ALL... buhahahahaha ;)
|
| Author: Nandini P 05 Nov 2008 | Member Level: Silver Points : 1 |
hi!!
Thank you so much for this code snippet..i used this snippet after trying other codes which of course doesn't work..and your code worked for me..it is easy to understand and use even after some modifications.. Thanks again.. keep doing the great work :)
|