Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

programatically sending email

12 views
Skip to first unread message

Bonj

unread,
Nov 3, 2004, 12:18:07 PM11/3/04
to
Right guys.

(I would like a solution to this in VB6 as this is what our needy app is
written in, but any solutions that involve .NET would be much appreciated
likewise as I could instantiate them, otherwise please forgive the
crossposting.)

I'm sure I've seen posts here before criticising the practice of automating
outlook for the purpose of programatically sending email, on the grounds that
it's naff. Well now we're really landed in it, it's more than naff. The IT
department have applied some security patch, and it means that a guy in our
department now has to sit there for about 10 minutes constantly clicking
"yes" to the message box that pops up saying "an external program is trying
to use outlook to send email, do you want to allow this?, blah blah blah".
So I desparately NEED to find a way of sending email without using outlook,
and I haven't got the foggiest! I've heard of something called "MIME" - is
this a load of API functions I need to be using?
One other thing - the configuration. It's dead easy to set up outlook in our
network - when loading the profile for the first time, you just tell it the
name of the exchange server to connect to (which we don't have control over)
and it picks it up. Can MIME (if that's the technology I need to be using)
connect to an exchange server?

I'm sure I could understand it once I knew the general structure, so any
links to the basics would be much appreciated, aswell as people's experience
with common pitfalls. No third party controls if possible, as our IT
department have to authorise things like that and they are mightily
suspicious of them.
But it would sure impress people if I could program our way out of this
stupid corner that IT have boxed us into, so any help is much appreciated!

Thanks

Herfried K. Wagner [MVP]

unread,
Nov 3, 2004, 12:22:18 PM11/3/04
to
"Bonj" <Bo...@discussions.microsoft.com> schrieb:

> So I desparately NEED to find a way of sending email
> without using outlook, and I haven't got the foggiest!

Sending and receiving email
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=email&lang=en>

> I've heard of something called "MIME" - is
> this a load of API functions I need to be using?

MIME is used for encoding mail attachments, for example.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nicholas Paldino [.NET/C# MVP]

unread,
Nov 3, 2004, 12:27:02 PM11/3/04
to
Bonj,

See inline:


> I've heard of something called "MIME" - is
> this a load of API functions I need to be using?

MIME is short for Multipurpose Internet Mail Extension (I believe). It
is a way of formatting content in messages, it's not a protocol for sending
them.

> One other thing - the configuration. It's dead easy to set up outlook in
> our
> network - when loading the profile for the first time, you just tell it
> the
> name of the exchange server to connect to (which we don't have control
> over)
> and it picks it up. Can MIME (if that's the technology I need to be using)
> connect to an exchange server?

If your exchange server supports the IMAP or POP3 protocols, I would
suggest looking at the Indy Project:

http://www.indyproject.org

It has a number of classes that you can use to send/receive mail. The
thing is, it won't connect to Exchange directly, so you will have to connect
through the POP3 or IMAP connector.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

Jay B. Harlow [MVP - Outlook]

unread,
Nov 3, 2004, 12:31:29 PM11/3/04
to
Bonj
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...

See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ol2003_ta/html/odc_olsecnotescomaddins.asp

Further info can be found at:
http://www.slipstick.com/dev/ol2003problems.htm
http://www.slipstick.com/outlook/esecup/admin.htm

Hope this helps
Jay


"Bonj" <Bo...@discussions.microsoft.com> wrote in message
news:A3146A4F-ECE1-4EC2...@microsoft.com...

Nospam

unread,
Nov 3, 2004, 12:35:01 PM11/3/04
to

"Bonj" <Bo...@discussions.microsoft.com> wrote in message
news:A3146A4F-ECE1-4EC2...@microsoft.com...

I would ask the IT department how to deal with the problem since THEY are
causing it and preventing YOU from doing your job.
Why should you (and your department) have to spent time (and hence money)
because another department is imposing it's own rules.
The IT department is suppose to help its users, not hinder them!!

John..


Bob O`Bob

unread,
Nov 3, 2004, 1:29:37 PM11/3/04
to
Nicholas Paldino [.NET/C# MVP] wrote:

>
> It has a number of classes that you can use to send/receive mail. The
> thing is, it won't connect to Exchange directly, so you will have to connect
> through the POP3 or IMAP connector.


POP3 and IMAP are protocols for receiving mail,
I don't think they'd be much help with sending.

Bob
--

Paul Bobrowski

unread,
Nov 3, 2004, 1:36:29 PM11/3/04
to
"Nospam" <nos...@please.co.uk> wrote in message
news:418916c6$0$25543$afc3...@news.easynet.co.uk...

The box that is a problem is a "feature" Microsoft added to later versions
of Outlook 2000 security patches. This anonying feature was implimented to
prevent script based virii from mass mailing.

While I can say that the box is anonying, I'd much rather deal with it then
leave a system open to virus attacks since it's not properly maintained.

Here is the response I sent to Terry Holland about this very subject earlier
today:

The first option that comes to mind is for you to use CDO to directly access
Outlook and avoid the nice interface you are using. Note that CDO is a pain
to code in. The another option is to use a program called Outlook
Redemption (http://www.dimastr.com/redemption/), using this will allow you
to use the code you have already written with very few changes. I used it a
few years ago and it wasn't too expensive, had a lenient license, and the
creator was very helpful and quick at responding to questions. The final
option is to access the popup box from VB and sendkey commands to it to
automatically close it.

Outlook Redemption is really the best solution in my eyes; however, you
could use SendKeys. It's messing and definately not proper coding in my
eyes, but it will get the job none without a 3rd party program.


Jay B. Harlow [MVP - Outlook]

unread,
Nov 3, 2004, 1:43:43 PM11/3/04
to
Paul,

> The first option that comes to mind is for you to use CDO to directly
> access
> Outlook and avoid the nice interface you are using. Note that CDO is a
> pain
> to code in. The another option is to use a program called Outlook
> Redemption (http://www.dimastr.com/redemption/), using this will allow you
Note: CDO 1.2.1 that ships with current versions of Outlook has the same
security feature.

Hope this helps
Jay

"Paul Bobrowski" <nos...@msdiscussion.com> wrote in message
news:Ox3%23ARdwE...@TK2MSFTNGP14.phx.gbl...

Nicholas Paldino [.NET/C# MVP]

unread,
Nov 3, 2004, 1:50:52 PM11/3/04
to
It also supports SMTP, I think that was what I was going for.

Thanks for the correction.


--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"Bob O`Bob" <filt...@yahoogroups.com> wrote in message
news:u5kHUMdw...@TK2MSFTNGP10.phx.gbl...

Bonj

unread,
Nov 3, 2004, 3:03:58 PM11/3/04
to
Thanks a lot all...I'll check out some of the links and see if anything can
be done.
I think I meant "MAPI", not "MIME" - picked the wrong acronym, sorry! I'm
not actually at all interested in encoding any mail...


"Bonj" <Bo...@discussions.microsoft.com> wrote in message
news:A3146A4F-ECE1-4EC2...@microsoft.com...

Gaurav - http://www.gauravcreations.com

unread,
Nov 4, 2004, 1:09:02 AM11/4/04
to
some solutions

1. u can use a software called "Express ClickYes" from www.contextmagic.com
, It will bypass those security boxes that pop up in outlook

2. Use vbsendmail.ddl component for sending mails .. it's very simple to use
http://www.freevbcode.com/ShowCode.Asp?ID=109

--
Gaurav Creations

Bonj

unread,
Nov 4, 2004, 1:53:21 AM11/4/04
to
That's a very very good point, and is nice to hear....

"Nospam" <nos...@please.co.uk> wrote in message
news:418916c6$0$25543$afc3...@news.easynet.co.uk...
>

Bonj

unread,
Nov 4, 2004, 5:25:02 AM11/4/04
to
Hi
Thanks for all the replies, I managed to get it to work using CDO, via the
System.Web.Mail namespace, however it will only send a mail from a machine
that has got IIS SMTP server running on it, and if I stop it, then it still
works - but the mail only arrives when the SMTP server is restarted. Using
Smtp.SmtpServer property (Insert or just plain setting it) doesn't seem to
affect the out come at all.
Does anybody know how I can get it to use a particular exchange server (that
we don't have control over) whether IIS is installed locally or not?

Martin

unread,
Nov 4, 2004, 7:40:59 AM11/4/04
to
Here's some code I used once upon a time (in VB5):

MAPISession1.NewSession = False
MAPISession1.LogonUI = False
MAPISession1.DownLoadMail = False
MAPISession1.UserName = vbNullString
MAPISession1.SignOn

MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.MsgIndex = -1
MAPIMessages1.Compose
MAPIMessages1.RecipDisplayName = eMailAddress$
MAPIMessages1.MsgSubject = "Message From My Program!"

X$ = "Testing, testing, 1 , 2, 3" & vbCrLf
X$ = X$ & "This is line #2" & vbCrLf
X$ = X$ & "Etc." & vbCrLf

MAPIMessages1.MsgNoteText = X$
MAPIMessages1.Send False

DoEvents

MAPISession1.SignOff

Martin

unread,
Nov 4, 2004, 7:51:17 AM11/4/04
to
Whoops... :(

I just tried this (using the program I took the code from) and was
surprised to see that the warning you're trying to avoid popped up. I
had never seen this before (its been several years since I used this).

I guess this code won't help you at all.

Sorry.


On Thu, 04 Nov 2004 05:40:59 -0700, Martin <martin...@comcast.net>
wrote:

Bonj

unread,
Nov 4, 2004, 8:29:02 AM11/4/04
to
Oh, really! - does it!

That's good to know - I'll not go down that road then

I'm really trying to get it to work by using CDO without having IIS
installed on the machine, but it doesn't matter if it does because a lot of
the machines have got IIS installed.

Cheers anyway

Ralph

unread,
Nov 4, 2004, 10:36:10 AM11/4/04
to

"Bonj" <Bo...@discussions.microsoft.com> wrote in message
news:76234DC6-7610-4E24...@microsoft.com...

> Hi
> Thanks for all the replies, I managed to get it to work using CDO, via the
> System.Web.Mail namespace, however it will only send a mail from a machine
> that has got IIS SMTP server running on it, and if I stop it, then it
still
> works - but the mail only arrives when the SMTP server is restarted. Using
> Smtp.SmtpServer property (Insert or just plain setting it) doesn't seem to
> affect the out come at all.
> Does anybody know how I can get it to use a particular exchange server
(that
> we don't have control over) whether IIS is installed locally or not?
>
>
>
> "Bonj" wrote:
>

I was hesitant to offer a reply as we resolved this problem somewhat
differently. We had a client that was running a suite of applications that
utilized email services. They broke for very much the reasons you listed. We
punted and implemented a COM+ messaging service. Notifications to send an
email were then sent to a central service which had its own email account.

hth
-ralph


Jay B. Harlow [MVP - Outlook]

unread,
Nov 4, 2004, 11:13:57 AM11/4/04
to
Ralph (& Bonj),
I was at a client earlier this year that did the same thing. They set up a
Web Service that would send an email, which in many ways makes sense. As you
do not need to open up or manage allot of machines with the CDONTS or CDOSYS
on them. You can simply manage a single machine with CDOSYS on it. Allowing
better control in the fight against viruses, worms & other things
potentially infecting the networks...

They also had a special Queue they could use for Message Queuing
applications (MQ Series, MSMQ)...

Hope this helps
Jay

"Ralph" <msnews.20.nt...@spamgourmet.com> wrote in message
news:efPLcQow...@TK2MSFTNGP10.phx.gbl...

0 new messages