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...
"rj" <rj****@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.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..