WORD/OUTLOOK omail:send()

WORD/OUTLOOK omail:send()

Postby Otto » Fri Mar 03, 2023 10:00 am

Hello friends,
I read that If you want to send a specific email immediately, regardless of the configuration, you can use the oMail.Send method with the True parameter. For example:

oMail.Send True

But I can't find out the Harbour syntax for oMail:Send()? How to pass TRUE.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: WORD/OUTLOOK omail:send()

Postby Otto » Sat Mar 04, 2023 2:24 am

I use the "Outlook.Application" object function to retrieve an existing instance of the Outlook application object and then use a method to send emails that are stored in the "Outbox" folder, which is where outgoing emails are temporarily stored before they are sent.

Here's an example of how you can send emails from the "Outbox" folder using theOutlook.Application-Object.
Best regards,
Otto

Code: Select all  Expand view


function Main()

   local olApp       := CreateObject( "Outlook.Application" )
   local olns        := olApp:GetNameSpace( "MAPI" )
   local oUserFolder := olns:Folders( "info@winhotel.at" )
   local oFolder     := oUserFolder:Folders( "Posteingang"  )
   local n, n2, n3, n4
   local aFolders    := {}
   local oMail
   local aEmails := {}

   // function to retrieve an existing instance of the Outlook application object
   // and then use a method to send emails that are stored in the "Outbox" folder,
   // which is where outgoing emails are temporarily stored before they are sent.

   // It then loops through all items in the "Outbox" folder and sends any email that has not been sent yet using the Send method.

   FOR n = 1 to olNS:Folders:Count
      AADD( aFolders, olNS:Folders( n ):name )

      if olNS:Folders( n ):name = "info@winhotel.at" //"otto@atzwanger.com"
         oUserFolder := olNS:Folders( n )
         FOR n2 = 1 to oUserFolder:Folders:Count
            AADD( aEmails, { oUserFolder:Folders( n2 ):name , "V E R Z E I C H N I S", oUserFolder:Folders:Count } )
            oFolder :=  oUserFolder:Folders( n2 )
            if oUserFolder:Folders( n2 ):name = "Postausgang"
               AADD( aEmails, { oFolder:name , "o F o l d e r ",  oFolder:Items:Count } )
               FOR n4 = 1 to oFolder:Items:Count
                  oMail  := oFolder:Items( n4 )
                  AADD( aEmails, { oUserFolder:Folders( n2 ):name , oMail:subject } )
                  oMail:Send()
               next
            endif
         next
      endif


   next

   xbrowse( aEmails )

return nil


 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: WORD/OUTLOOK omail:send()

Postby Jimmy » Sat Mar 04, 2023 10:25 pm

hi Otto,

thx for sharing yout Solution

---

as "Postausgang" is for German / AT only i recommend to use Outllok Constant
Code: Select all  Expand view
#DEFINE olFolderOutbox                          4
#DEFINE olFolderSentMail                        5
#DEFINE olFolderInbox                           6

so this should work
Code: Select all  Expand view
  aOutItem := ::oNameSpace:getDefaultFolder( olFolderOutbox ) :Items
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: WORD/OUTLOOK omail:send()

Postby Otto » Sun Mar 05, 2023 7:57 am

Hello Jimmy, I changed my code. Thank you so much and have a nice Sunday.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests