Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Sending attachments using MAPI and outlook security alert message.

Sending attachments using MAPI and outlook security alert message.

Scheduled Pinned Locked Moved Visual Basic
csharpdockersecurityquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alexander132
    wrote on last edited by
    #1

    Hi Friends, i have written code in VB .net for sending mail using MAPI. I am facing two problems. 1. The mail does go, but when i give an attachment, it gives the following exception. System.Runtime.InteropServices.COMException (0x800A7D02): Unspecified Failure has occurred at MSMAPI.MAPIMessagesClass.Send(Object vDialog) at ProcTryMail.tryMail.Pr_SendMail() in D:\Projects\Ems\Backup_Nov17OutSeq\ProcTryMail\tryMail.vb:line 30 MSDN says this occurs when multiple attachments are put. 2. when i finally send mail, i get an outlook warning saying: 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". The code is given below. Public Class tryMail Private objMapiSession As MSMAPI.MAPISession Private objMapiMsgs As MSMAPI.MAPIMessages Private objDebug As EMSDebug.cDebug Public Sub Pr_SendMail() Try objMapiSession = New MSMAPI.MAPISession() objMapiMsgs = New MSMAPI.MAPIMessages() objMapiSession.LogonUI = False objMapiSession.SignOn() objMapiMsgs.SessionID = objMapiSession.SessionID objMapiMsgs.Compose() objMapiMsgs.RecipDisplayName = "-- give a mail id here --" objMapiMsgs.MsgSubject = "From .NET MAPI" objMapiMsgs.AttachmentPathName = "-- give a filepath here --" objMapiMsgs.Send(False) objMapiSession.SignOff() objMapiSession = Nothing objMapiMsgs = Nothing Catch End Try End Sub End Class thanks Alex

    D 1 Reply Last reply
    0
    • A alexander132

      Hi Friends, i have written code in VB .net for sending mail using MAPI. I am facing two problems. 1. The mail does go, but when i give an attachment, it gives the following exception. System.Runtime.InteropServices.COMException (0x800A7D02): Unspecified Failure has occurred at MSMAPI.MAPIMessagesClass.Send(Object vDialog) at ProcTryMail.tryMail.Pr_SendMail() in D:\Projects\Ems\Backup_Nov17OutSeq\ProcTryMail\tryMail.vb:line 30 MSDN says this occurs when multiple attachments are put. 2. when i finally send mail, i get an outlook warning saying: 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". The code is given below. Public Class tryMail Private objMapiSession As MSMAPI.MAPISession Private objMapiMsgs As MSMAPI.MAPIMessages Private objDebug As EMSDebug.cDebug Public Sub Pr_SendMail() Try objMapiSession = New MSMAPI.MAPISession() objMapiMsgs = New MSMAPI.MAPIMessages() objMapiSession.LogonUI = False objMapiSession.SignOn() objMapiMsgs.SessionID = objMapiSession.SessionID objMapiMsgs.Compose() objMapiMsgs.RecipDisplayName = "-- give a mail id here --" objMapiMsgs.MsgSubject = "From .NET MAPI" objMapiMsgs.AttachmentPathName = "-- give a filepath here --" objMapiMsgs.Send(False) objMapiSession.SignOff() objMapiSession = Nothing objMapiMsgs = Nothing Catch End Try End Sub End Class thanks Alex

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The second problem is caused by a security setting in Outlook that Microsoft put in after the outbreak of viruses that emailed themselves to everyone in your Outlook address book. To turn it off, open Outlook (Express) and pick Options from the Tools menu, then click the Security tab, then uncheck "Warn me when applications try to send mail as me." There is no method of getting around this programatically, for obvious reasons... RageInTheMachine9532

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups