468,765 Members | 1,513 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Sending Emails from Code


I have a program that sends emails automatically. It works correctly, but
each time it sends an email, a message appears warning the user and they have
to wait 5 seconds for the Yes button to appear before they can click it.
This is a bit annoying.

Is there an Outlook setting that will stop this message appearing? Or can I
edit the code?

It is written in VB .Net:
Dim Email As New OutlookClass
Dim Message As Outlook.MailItem

Message = Email.OutlookApp.CreateItem(0)
Message.To = "Email address"
Message.Subject = "TCI Card "
Message.Body = "Text"
Message.Send()

Thanks,
Helen

--
Helen
Jan 5 '06 #1
4 942
"Helen Trim" <He*******@discussions.microsoft.com> schrieb:
I have a program that sends emails automatically. It works correctly, but
each time it sends an email, a message appears warning the user and they
have
to wait 5 seconds for the Yes button to appear before they can click it.
This is a bit annoying.


I am curious why you are not using 'System.Web.Mail' (.NET 1.0/1.1) or
'System.Net.Mail' (.NET 2.0), which won't require Outlook to be installed.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 5 '06 #2
Good point, Herfried.

It is a Windows application and I haven't found out yet how to send email
without using Outlook.

I'll keep looking but if you have any tips, I'd be very grateful.

Thanks
Helen
--
Helen
"Herfried K. Wagner [MVP]" wrote:
"Helen Trim" <He*******@discussions.microsoft.com> schrieb:
I have a program that sends emails automatically. It works correctly, but
each time it sends an email, a message appears warning the user and they
have
to wait 5 seconds for the Yes button to appear before they can click it.
This is a bit annoying.


I am curious why you are not using 'System.Web.Mail' (.NET 1.0/1.1) or
'System.Net.Mail' (.NET 2.0), which won't require Outlook to be installed.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 5 '06 #3
You need to add a reference to system.web (even from a Windows application).

See http://www.systemwebmail.com/

--
HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Concept S2i inc. (www.s2i.com)
http://emoreau.s2i.com/

"Helen Trim" <He*******@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
Good point, Herfried.

It is a Windows application and I haven't found out yet how to send email
without using Outlook.

I'll keep looking but if you have any tips, I'd be very grateful.

Thanks
Helen
--
Helen
"Herfried K. Wagner [MVP]" wrote:
"Helen Trim" <He*******@discussions.microsoft.com> schrieb:
> I have a program that sends emails automatically. It works correctly,
> but
> each time it sends an email, a message appears warning the user and
> they
> have
> to wait 5 seconds for the Yes button to appear before they can click
> it.
> This is a bit annoying.


I am curious why you are not using 'System.Web.Mail' (.NET 1.0/1.1) or
'System.Net.Mail' (.NET 2.0), which won't require Outlook to be
installed.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 5 '06 #4
Add the reference as Heinfred pointed out. Here's a simple, but working
function.

Private Function SendMail() As Boolean

'Set up SMTP mail parameters
Dim Email As New MailMessage
Email.To = EmailTo 'String variable
Email.From = EmailFrom 'String variable
Email.Subject = EmailSubject 'String variable
Email.Body = EmailBody 'String variable
SmtpMail.SmtpServer = (SMTPServer) 'Name of your SMTP server

'Send the mail
SmtpMail.Send(Email)

End Function

Jan 5 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by dan glenn | last post: by
10 posts views Thread by Stuart Mueller | last post: by
5 posts views Thread by Kun | last post: by
2 posts views Thread by lstanikmas | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.