Adnan
asked on
How to send simple mail from windows form....
Hi
I want to send a simple mail from my windows app using Outlook.Application but the outlook app will not start ???
Can somone show me how i can send a simple mail from windows form by using outlook
I want to send a simple mail from my windows app using Outlook.Application but the outlook app will not start ???
Can somone show me how i can send a simple mail from windows form by using outlook
private void SendTransactionByEmail()
{
Microsoft.Office.Interop.Outlook.Application outLookApp = new Microsoft.Office.Interop.Outlook.Application();
// Create the mail message
Microsoft.Office.Interop.Outlook.MailItem mailItem = (MailItem)outLookApp.CreateItem(OlItemType.olMailItem);
mailItem.Subject = "some subject goes here";
mailItem.BodyFormat = OlBodyFormat.olFormatHTML;
mailItem.Body = "email body goes here";
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
thanks for the post, i modified the code to work for me in Visual Basic .NET, e.g. :
Private oApp As New Microsoft.Office.Interop.Outlook.Application
Private oMsg As Microsoft.Office.Interop.Outlook.MailItem
Private oRecip As Microsoft.Office.Interop.Outlook.Recipient
Private Sub PrePrepareEmail()
oMsg = oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
oRecip = oMsg.Recipients.Add("test@test.com")
oRecip.Resolve()
oMsg.Display(True)
End Sub
Private Sub WheneverLater()
oApp = Nothing
oMsg = Nothing
oRecip = Nothing
End Sub
ASKER