|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to send an Email in VB.NETHi all,
Does anyone have a simple SendEmail routine? I want to be able to set the Subject, Send To address, Body and SMTP server details (server, username, password). Thanks You can use the system.web.mail to do exactly what you are wanting to do.
Norm On 1/14/06 9:45 AM, in article 43c91c9a$0$23294$db0fe***@news.zen.co.uk, Show quoteHide quote "me" <c**@notvalid.com> wrote: > Hi all, > > Does anyone have a simple SendEmail routine? > > I want to be able to set the Subject, Send To address, Body and SMTP server > details (server, username, password). > > Thanks > > "me" <c**@notvalid.com> schrieb: ..NET 1.0/1.1:> Does anyone have a simple SendEmail routine? > > I want to be able to set the Subject, Send To address, Body and SMTP > server details (server, username, password). 'System.Web.Mail' (in "System.Web.dll"). ..NET 2.0: 'System.Net.Mail'. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> This works fine in .NET 2.0 and does not depend on CDO objects. It can be
used with independent providers because you can use authentication. Dim msg As New System.Net.Mail.MailMessage Dim smtp As New System.Net.Mail.SmtpClient Dim addrFrom As New System.Net.Mail.MailAddress("f***@me.com") Dim addrTo As New System.Net.Mail.MailAddress(***@you.com") msg.From = addrFrom msg.To.Add(addrTo) msg.Subject = "Subject Text" msg.Body = "Body Text" smtp.Host = "smtpserver.provider.com" smtp.Port = 25 smtp.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network smtp.Credentials = New System.Net.NetworkCredential("isp-username", "isp-password") smtp.Send(msg) Jeroen Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht news:eToh$cSGGHA.1424@TK2MSFTNGP12.phx.gbl... > "me" <c**@notvalid.com> schrieb: >> Does anyone have a simple SendEmail routine? >> >> I want to be able to set the Subject, Send To address, Body and SMTP >> server details (server, username, password). > > .NET 1.0/1.1: > > 'System.Web.Mail' (in "System.Web.dll"). > > .NET 2.0: > > 'System.Net.Mail'. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> "me" <c**@notvalid.com> wrote in message Thanks all - this group is really helpful!news:43c91c9a$0$23294$db0fefd9@news.zen.co.uk... > Hi all, > > Does anyone have a simple SendEmail routine? > > I want to be able to set the Subject, Send To address, Body and SMTP > server details (server, username, password). > > Thanks
Regional settings cause runtime crash
Images inline with blog contents - HOW?? Referencing "Forms" objects from a module some advice How would I make this into a class ? simple program HELP. [VB.NET express 2005] - Regular expressions Tabbed MDI Interface IO locked error Sharing source code between Vs2003 and Vs2005 IDE After Select.......not really? |
|||||||||||||||||||||||