Solved

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

Posted on 2007-04-03
5
818 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

Industry Leaders: 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

749 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