Solved

outlook object help required send email automatically no prompt and plain text format

Posted on 2007-04-03
5
822 Views
Last Modified: 2013-12-20
i am using the outlook object in my vb app and i need to change the body text to plain text and also need to know how to send without outlook promting me when i do the send. I am using the follwoing code

  Set ole_app = CreateObject("Outlook.Application")
    Set ole_item = ole_app.CreateItem(0)
    ole_item.Subject = "My subject"l
    ole_item.TO = "abcd@so and sot"
    ole_item.body = body
 ole_item.Send
    Set ole_item = Nothing

0
Comment
Question by:pele4483
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 27

Expert Comment

by:VBRocks
ID: 18843627
My friend, I'm sorry to tell you this...  but you can't.  So to speak.  MS updated Outlook to throw that prompt every time someone tries to access the application using it's object model, and there is no way around it.

However...  I built an application using the Outlook Redemption object model, and it mirrors MS Outlook's object model, but allows you to send e-mails without getting that very anoying prompt.  It is a very nice tool, very easy to use, with enough documentation to help you out.  You can get more info about it at the following website:

http://www.dimastr.com/redemption/

Good luck!
0
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 50 total points
ID: 18849204
thats not quite correct...
you can use CDO 2.  It may not be quite as simple but it works well. It is installed along with MS Outlook client and can be installed independently i think.



' Done by Robberbaron.
' Last modified : 31.07.06

Private objMsg As Object
Private objConf As Object
Private objFlds As Object

Const sMailServerName = "xyz.com"

Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2 'Must use this to use Delivery Notification
Const cdoAnonymous = 0
Const cdoBasic = 1 ' clear text
Const cdoNTLM = 2 'NTLM
'Delivery Status Notifications
Const cdoDSNDefault = 0 'None
Const cdoDSNNever = 1 'None
Const cdoDSNFailure = 2 'Failure
Const cdoDSNSuccess = 4 'Success
Const cdoDSNDelay = 8 'Delay
Const cdoDSNSuccessFailOrDelay = 14 'Success, failure or delay



Public Function SendMail(tcaAddresses() As String, ByVal tcSubject As String, taAttachment() As String, Optional ByVal tcMessage As String = " ") As Boolean

   
    With objMsg
      Set .Configuration = objConf
      lnNumOfRecip = UBound(tcaAddresses, 1)
        'CurDir (goProjProperties.cAppPath)
        For lnCount = 0 To lnNumOfRecip - 1
            If lnCount > 0 Then
                'add a comma
                .To = .To & ","
            End
            .To = .To & Trim(tcaAddresses(lnCount, 0))
        Next
     
      '.to = "test@paulsadowski.com"
      .From = "mail@bornhorstward.com.au"
      .Subject = Space(2) & Trim(tcSubject)
      .TextBody = Space(lnNumOfAtt) & vbCrLf & tcMessage
       'use .HTMLBody to send HTML email.
     
        For lnCount = 0 To lnNumOfAtt - 1
           lcAttName = taAttachment(lnCount)
           .AddAttachment lcAttName
        Next
     
      .fields("urn:schemas:mailheader:disposition-notification-to") = "me@my.com"
      .fields("urn:schemas:mailheader:return-receipt-to") = "me@my.com"
      .DSNOptions = cdoDSNSuccessFailOrDelay
      .fields.Update
      .Send
    End With

    NewMail = True
   Exit Function
0
 
LVL 27

Expert Comment

by:VBRocks
ID: 18852073
Very nice!  I didn't know that.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month4 days, 22 hours left to enroll

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question