|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sending an Email from .net?Hi All,
How do i send an email from a vb.net form? I have a text box with the email address, another with the email body, and I want to use standard text for the subject. Is there a way for me to automatically open a "new mail form" from outlook, and automatically put these values in? Thanks in advance.. Public Sub NewMail(ByVal strTo As String, Optional ByVal strSubject As
String = "", Optional ByVal strMessage As String = "", Optional ByVal colAttachments As Collection = Nothing) Try Dim oApp As Outlook.Application oApp = New Outlook.Application MailObject = oApp.CreateItem(Outlook.OlItemType.olMailItem) With MailObject 'ATTACHMENTS!!!! Dim intX As Integer If colAttachments IsNot Nothing Then For intX = 1 To colAttachments.Count .Attachments.Add(colAttachments(intX), Outlook.OlAttachmentType.olByValue) Next End If .Subject = strSubject .To = strTo .Body =strMessage 'Send it directly! '.Send() 'Open it! .Display() End With oApp = Nothing Catch ex As Exception Throw ex Finally End Try End Sub A reference must be added to Outlook... Show quoteHide quote "rj" <rje***@gmail.com> wrote in message news:1147418210.174844.211100@g10g2000cwb.googlegroups.com... > Hi All, > > How do i send an email from a vb.net form? I have a text box with the > email address, another with the email body, and I want to use standard > text for the subject. Is there a way for me to automatically open a > "new mail form" from outlook, and automatically put these values in? > > Thanks in advance.. > "rj" <rje***@gmail.com> schrieb: Opening files, applications, Web documents, and the mail client> How do i send an email from a vb.net form? I have a text box with the > email address, another with the email body, and I want to use standard > text for the subject. Is there a way for me to automatically open a > "new mail form" from outlook, and automatically put these values in? <URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en> -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> rj,
A simple sample http://www.vb-tips.com/default.aspx?ID=549ce1f6-c497-4ad5-950f-9dd3d7bb8e60 be aware that we have some problems with our new website Cor Show quoteHide quote "rj" <rje***@gmail.com> schreef in bericht news:1147418210.174844.211100@g10g2000cwb.googlegroups.com... > Hi All, > > How do i send an email from a vb.net form? I have a text box with the > email address, another with the email body, and I want to use standard > text for the subject. Is there a way for me to automatically open a > "new mail form" from outlook, and automatically put these values in? > > Thanks in advance.. >
Multiple fields in a single textbox
Image Resource - not released DataViews with DataSets 'Incremental Search' of data base or "Wheres the 'Seek' method Reading and Writing Text Files Problem with MoveFile command in ASP page How to import always the FIRST available sheet from EXCEL-File Closing all forms at once Inherent encryption in .NET 2.0? dot.net com class function |
|||||||||||||||||||||||