I am using VB.NET 2008 and in the COM Tab I add a reference to "Microsoft
Outlook 11.0 Object Library".
When I send an email, a window with the following message (and buttons Yes,
No, Help) always pops up on the screen:
"A program is trying to automatically send e-mail on your behalf. Do you
want to allow this ?
If this is unexpected, it may be a virus and you should choose "No"."
Why does that window pop up, and how can I make it not popup ?
Thank you very much.
Main program
Private oMail As New OutlookMail
sub myForm_Load(...)
oMail.startOutlook()
end sub
Private Sub myForm_FormClosing(..)
oMail = Nothing
End Sub
Sub SendEmail(ByVal sMsg As String, ByVal sToEmail As String, ByVal sSubject
As String)
Dim swError As StreamWriter
If sToEmail <"" Then
oMail.SendEmail(sToEmail, sSubject, sMsg)
End If
End Sub
Private Sub cmdEmail_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdEmail.Click
SendEmail(txtLog.Text, txtEmails.Text, "my subject")
End Sub
Imports Outlook = Microsoft.Office.Interop.Outlook
Imports System
Public Class OutlookMail
Dim ns As Outlook.NameSpace
Public Function startOutlook()
'Return a reference to the MAPI layer
Dim ol As New Outlook.Application()
ns = ol.GetNamespace("MAPI")
ns.Logon(, , True, True)
End Function
Public Sub SendEmail(ByVal toVal As String, ByVal subjectVal As String,
ByVal bodyVal As String) ', ByVal sMailID As String)
Dim newMail As Outlook.MailItem
Dim fdMail As Outlook.MAPIFolder
fdMail =
ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFol derOutbox)
'assign values to the newMail MailItem
newMail = fdMail.Items.Add(Outlook.OlItemType.olMailItem)
newMail.Subject = subjectVal
newMail.Body = bodyVal
newMail.To = toVal
newMail.SaveSentMessageFolder = fdMail
newMail.Send()
End Sub
End Class 4 2000
Because you are accessing a mail client (Outlook), you will get Outlook's
built-in security. It comes up to prevent someone from writing a spam virus
that sends out gobs of email without the user knowing it.
I don't believe you can get around this since it is a security feature.
But, if you were to send mail (via code) directly from an SMTP server (like
MS Exchange) you wouldn't get that message.
-Scott
"fniles" <fn****@pfmail.comwrote in message
news:uu****************@TK2MSFTNGP03.phx.gbl...
>I am using VB.NET 2008 and in the COM Tab I add a reference to "Microsoft Outlook 11.0 Object Library".
When I send an email, a window with the following message (and buttons
Yes, No, Help) always pops up on the screen:
"A program is trying to automatically send e-mail on your behalf. Do you
want to allow this ?
If this is unexpected, it may be a virus and you should choose "No"."
Why does that window pop up, and how can I make it not popup ?
Thank you very much.
Main program
Private oMail As New OutlookMail
sub myForm_Load(...)
oMail.startOutlook()
end sub
Private Sub myForm_FormClosing(..)
oMail = Nothing
End Sub
Sub SendEmail(ByVal sMsg As String, ByVal sToEmail As String, ByVal
sSubject As String)
Dim swError As StreamWriter
If sToEmail <"" Then
oMail.SendEmail(sToEmail, sSubject, sMsg)
End If
End Sub
Private Sub cmdEmail_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdEmail.Click
SendEmail(txtLog.Text, txtEmails.Text, "my subject")
End Sub
Imports Outlook = Microsoft.Office.Interop.Outlook
Imports System
Public Class OutlookMail
Dim ns As Outlook.NameSpace
Public Function startOutlook()
'Return a reference to the MAPI layer
Dim ol As New Outlook.Application()
ns = ol.GetNamespace("MAPI")
ns.Logon(, , True, True)
End Function
Public Sub SendEmail(ByVal toVal As String, ByVal subjectVal As String,
ByVal bodyVal As String) ', ByVal sMailID As String)
Dim newMail As Outlook.MailItem
Dim fdMail As Outlook.MAPIFolder
fdMail =
ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFol derOutbox)
'assign values to the newMail MailItem
newMail = fdMail.Items.Add(Outlook.OlItemType.olMailItem)
newMail.Subject = subjectVal
newMail.Body = bodyVal
newMail.To = toVal
newMail.SaveSentMessageFolder = fdMail
newMail.Send()
End Sub
End Class
Thank you for your reply.
The reason why I use Outlook is because with Outlook I can easily see all
the mails I sent in the "Sent" folder, but I can't do that easily with SMTP.
"Scott M." <sm**@nospam.nospamwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Because you are accessing a mail client (Outlook), you will get Outlook's
built-in security. It comes up to prevent someone from writing a spam
virus that sends out gobs of email without the user knowing it.
I don't believe you can get around this since it is a security feature.
But, if you were to send mail (via code) directly from an SMTP server
(like MS Exchange) you wouldn't get that message.
-Scott
"fniles" <fn****@pfmail.comwrote in message
news:uu****************@TK2MSFTNGP03.phx.gbl...
>>I am using VB.NET 2008 and in the COM Tab I add a reference to "Microsoft Outlook 11.0 Object Library". When I send an email, a window with the following message (and buttons Yes, No, Help) always pops up on the screen: "A program is trying to automatically send e-mail on your behalf. Do you want to allow this ? If this is unexpected, it may be a virus and you should choose "No"."
Why does that window pop up, and how can I make it not popup ? Thank you very much.
Main program Private oMail As New OutlookMail
sub myForm_Load(...) oMail.startOutlook() end sub
Private Sub myForm_FormClosing(..) oMail = Nothing End Sub
Sub SendEmail(ByVal sMsg As String, ByVal sToEmail As String, ByVal sSubject As String) Dim swError As StreamWriter
If sToEmail <"" Then oMail.SendEmail(sToEmail, sSubject, sMsg) End If
End Sub
Private Sub cmdEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEmail.Click SendEmail(txtLog.Text, txtEmails.Text, "my subject") End Sub
Imports Outlook = Microsoft.Office.Interop.Outlook Imports System Public Class OutlookMail Dim ns As Outlook.NameSpace Public Function startOutlook() 'Return a reference to the MAPI layer Dim ol As New Outlook.Application()
ns = ol.GetNamespace("MAPI") ns.Logon(, , True, True) End Function Public Sub SendEmail(ByVal toVal As String, ByVal subjectVal As String, ByVal bodyVal As String) ', ByVal sMailID As String) Dim newMail As Outlook.MailItem Dim fdMail As Outlook.MAPIFolder
fdMail = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderOutbox)
'assign values to the newMail MailItem newMail = fdMail.Items.Add(Outlook.OlItemType.olMailItem) newMail.Subject = subjectVal newMail.Body = bodyVal newMail.To = toVal newMail.SaveSentMessageFolder = fdMail newMail.Send() End Sub End Class
When sending mail from a server, you must look at the server logs to see
what's been sent.
"fniles" <fn****@pfmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Thank you for your reply.
The reason why I use Outlook is because with Outlook I can easily see all
the mails I sent in the "Sent" folder, but I can't do that easily with
SMTP.
"Scott M." <sm**@nospam.nospamwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>Because you are accessing a mail client (Outlook), you will get Outlook's built-in security. It comes up to prevent someone from writing a spam virus that sends out gobs of email without the user knowing it.
I don't believe you can get around this since it is a security feature. But, if you were to send mail (via code) directly from an SMTP server (like MS Exchange) you wouldn't get that message.
-Scott
"fniles" <fn****@pfmail.comwrote in message news:uu****************@TK2MSFTNGP03.phx.gbl...
>>>I am using VB.NET 2008 and in the COM Tab I add a reference to "Microsoft Outlook 11.0 Object Library". When I send an email, a window with the following message (and buttons Yes, No, Help) always pops up on the screen: "A program is trying to automatically send e-mail on your behalf. Do you want to allow this ? If this is unexpected, it may be a virus and you should choose "No"."
Why does that window pop up, and how can I make it not popup ? Thank you very much.
Main program Private oMail As New OutlookMail
sub myForm_Load(...) oMail.startOutlook() end sub
Private Sub myForm_FormClosing(..) oMail = Nothing End Sub
Sub SendEmail(ByVal sMsg As String, ByVal sToEmail As String, ByVal sSubject As String) Dim swError As StreamWriter
If sToEmail <"" Then oMail.SendEmail(sToEmail, sSubject, sMsg) End If
End Sub
Private Sub cmdEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEmail.Click SendEmail(txtLog.Text, txtEmails.Text, "my subject") End Sub
Imports Outlook = Microsoft.Office.Interop.Outlook Imports System Public Class OutlookMail Dim ns As Outlook.NameSpace Public Function startOutlook() 'Return a reference to the MAPI layer Dim ol As New Outlook.Application()
ns = ol.GetNamespace("MAPI") ns.Logon(, , True, True) End Function Public Sub SendEmail(ByVal toVal As String, ByVal subjectVal As String, ByVal bodyVal As String) ', ByVal sMailID As String) Dim newMail As Outlook.MailItem Dim fdMail As Outlook.MAPIFolder
fdMail = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olF olderOutbox)
'assign values to the newMail MailItem newMail = fdMail.Items.Add(Outlook.OlItemType.olMailItem) newMail.Subject = subjectVal newMail.Body = bodyVal newMail.To = toVal newMail.SaveSentMessageFolder = fdMail newMail.Send() End Sub End Class
"fniles" <fn****@pfmail.com>'s wild thoughts were released
on Tue, 10 Jun 2008 14:48:48 -0500 bearing the following
fruit:
>I am using VB.NET 2008 and in the COM Tab I add a reference to "Microsoft Outlook 11.0 Object Library". When I send an email, a window with the following message (and buttons Yes, No, Help) always pops up on the screen: "A program is trying to automatically send e-mail on your behalf. Do you want to allow this ? If this is unexpected, it may be a virus and you should choose "No"."
Why does that window pop up, and how can I make it not popup ?
There are lots of products out there, some free that disable
the security prompt - try mapilab.
J
>Thank you very much.
Main program Private oMail As New OutlookMail
sub myForm_Load(...)
oMail.startOutlook() end sub
Private Sub myForm_FormClosing(..)
oMail = Nothing End Sub
Sub SendEmail(ByVal sMsg As String, ByVal sToEmail As String, ByVal sSubject As String)
Dim swError As StreamWriter
If sToEmail <"" Then
oMail.SendEmail(sToEmail, sSubject, sMsg)
End If
End Sub
Private Sub cmdEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEmail.Click
SendEmail(txtLog.Text, txtEmails.Text, "my subject") End Sub
Imports Outlook = Microsoft.Office.Interop.Outlook Imports System Public Class OutlookMail
Dim ns As Outlook.NameSpace
Public Function startOutlook()
'Return a reference to the MAPI layer
Dim ol As New Outlook.Application()
ns = ol.GetNamespace("MAPI")
ns.Logon(, , True, True)
End Function
Public Sub SendEmail(ByVal toVal As String, ByVal subjectVal As String, ByVal bodyVal As String) ', ByVal sMailID As String)
Dim newMail As Outlook.MailItem
Dim fdMail As Outlook.MAPIFolder
fdMail = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderOutbox)
'assign values to the newMail MailItem
newMail = fdMail.Items.Add(Outlook.OlItemType.olMailItem)
newMail.Subject = subjectVal
newMail.Body = bodyVal
newMail.To = toVal
newMail.SaveSentMessageFolder = fdMail
newMail.Send()
End Sub End Class
--
Jan Hyde https://mvp.support.microsoft.com/profile/Jan.Hyde This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John |
last post by:
Hi
When I open a new outlook email from vb.net, sometimes outlook is very slow
to appear or occasionally outlook freezes completely. I am targeting mixed
office2000/xp environments so I am...
|
by: John |
last post by:
Hi
I am trying to find the way to create an email in outlook. I am using the
code given at the end. It works fine the first time but calling the code
second time gives the following error;
...
|
by: Srinivas |
last post by:
hi all
how to access the outlook user profiles through VB.net
any help....
thanks in advanc
Srinivas
|
by: Li Pang |
last post by:
Hi,
I used following codes to pass a message item from CDO to Outlook. They
worked fine when I used outlook 2000, but get an error of "Specified cast is
not valid." when I used Outlook 2003....
|
by: wizzbangca |
last post by:
Hi everyone. Having problems with a utility I am writing for work.
The previous IT Director thoughtfully allowed 3 (2000, xp, 2003)
versions of outlook to be installed rather than 1. Now I need...
|
by: Pieter |
last post by:
Hi,
On the pc of one of my clients (W2000, Office 2003) I'm getting sometimes an
exception when moving (Move) a MailItem to an Outlook-Folder: The RPC server
is not available. (Exception from...
|
by: Pieter |
last post by:
Hi,
I'm using a thight integration with Outlook 2003 (with an Exchange server)
in my VB.NET (2005) application.
Until now I'm using the Outlook Object Model, but it appears to be very
slow, and...
|
by: Dean Spencer |
last post by:
Can anyone help? I am importing Emails from Outlook using the following
code:
Public Function ScanInbox(SubjectLine As String)
Dim TempRst As Recordset
Dim OlApp As Outlook.Application
Dim...
|
by: fniles |
last post by:
I am using VB.NET 2005. I created a project using the Microsoft Outlook 8.0
Object Library (Object Model) in my previous machine. Now that I have a new
machine, when I try to compile that program...
|
by: Sylfelin |
last post by:
Hello,
If I use Microsoft Outlook 12.0 Object Library (Outlook 2007) COM
Object in my application, the custommer must have the outlook 2007 on
his computer ?
But if i use Microsoft Outlook...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |