473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Send an Email with Outlook using VB .Net

Hi,
I need to send the same Email to different people. I'm using Outlook
XP and VB.Net. I tryed with the following code:

Dim oOutL As Outlook.Application
Dim oMail As Outlook._MailItem

oOutL = CreateObject("outlook.application")

For i = 0 To Email.Length - 1
oMail =
oOutL.CreateItem(Outlook.OlItemType.olMailItem)
oMail.UnRead = True
oMail.To = Email(i)
oMail.Subject = "My Subject"
oMail.HTMLBody = True
oMail.Body = "My Body"
oMail.Attachments.Add(FilePath & "attachement.html")
oMail.Send()
Next

but all i got is an Email without my name on it in the "FROM" field,
how can i add it?

another solution that I thought for send those Emails is to manually
create the Email and save it in the local disk and with VB.NET just
open it, paste the mail address in the "TO" field and send it, but I
don't know how open an Email from the code.

Can you help me?

Thanks

Michele
Nov 20 '05 #1
1 47328
Michele,
In addition to OHM's suggestion of using the System.Web.Mail namespace,
which for simply sending emails is much easier.

Do you have the XP PIA installed? See "Office XP Primary Interop Assembly"
at the url below.

The following code works with Outlook 2003 with the Outlook 2003 PIA
installed, of course it is subject to the Outlook security prompts.

Dim oOutL As New Outlook.Application
Dim oMail As Outlook.MailItem

oMail = oOutL.CreateItem(Outlook.OlItemType.olMailItem)
oMail.UnRead = True
oMail.To = "xx*@xxx.com"
oMail.Subject = "My Subject"
oMail.HTMLBody = True
oMail.Body = "My Body"
oMail.Attachments.Add("attachement.html")
oMail.Send()
Return

The following site contains a plethora of articles on using Outlook with
..NET:

http://www.microeye.com/resources/res_outlookvsnet.htm

To avoid the Outlook security prompts its generally easiest to create a
properly constructed COM-Addin for Outlook 2003. There are other methods
available for other versions of Outlook...

Hope this helps
Jay

"Michele" <mi****@tin.it> wrote in message
news:31**************************@posting.google.c om...
Hi,
I need to send the same Email to different people. I'm using Outlook
XP and VB.Net. I tryed with the following code:

Dim oOutL As Outlook.Application
Dim oMail As Outlook._MailItem

oOutL = CreateObject("outlook.application")

For i = 0 To Email.Length - 1
oMail =
oOutL.CreateItem(Outlook.OlItemType.olMailItem)
oMail.UnRead = True
oMail.To = Email(i)
oMail.Subject = "My Subject"
oMail.HTMLBody = True
oMail.Body = "My Body"
oMail.Attachments.Add(FilePath & "attachement.html")
oMail.Send()
Next

but all i got is an Email without my name on it in the "FROM" field,
how can i add it?

another solution that I thought for send those Emails is to manually
create the Email and save it in the local disk and with VB.NET just
open it, paste the mail address in the "TO" field and send it, but I
don't know how open an Email from the code.

Can you help me?

Thanks

Michele

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Google Mike | last post by:
I've got RH9 Linux with default PHP. Is there a way to send email on Linux to an Exchange Server from PHP and/or other tools when there is *NOT* SMTP access? Has anyone figured out a way to...
0
by: David Burson | last post by:
Hi, I have a VB.NET windows app that needs to automatically send a simple text email when my users run a new version of the app for the first time. I thought this would be simple, but after...
0
by: Akira | last post by:
Could someone tell me how to send outlook appointment email from asp page? I would like appointment email just like one outlook can send out. I tried to look for an answer for this, but it seems...
4
by: tp | last post by:
HI... I have created simple .asp page and i would like to send my page as email using my outlook . is it possible to send form body as new email outlook body using mailto command or any other...
1
by: Paul | last post by:
I am using a windows service which accesses Microsoft Outlook. Outlook is supposed to send an email. This works fine when not run in a windows service. I am running the service under my user...
8
by: John Brock | last post by:
I am currently using a VB.NET program to send out e-mails with plain text bodies (plus one attachment). The emails are being received as Rich Text messages (probably just my personal Outlook...
9
by: Mahernoz | last post by:
Can i send an email from JavaScript? Is it possible? If yes please the code to send email using javascript...
5
by: pat | last post by:
Hi, i'am using an ac2K progrom which sends automaticle emails with an attachment. Since last week , a error occurs with number 2293. Our mail program is Outlook 2003. It's probably a matter...
1
by: sxwend | last post by:
I am trying to use the following post results (http://www.thescripts.com/forum/thread189759.html) and add another requirement. I need to send the results to just the email addresses that the query...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.