Alaska Software Inc. - outlook 2010 - does not change the FROM account
Username: Password:
AuthorTopic: outlook 2010 - does not change the FROM account
Tiziano Piccininioutlook 2010 - does not change the FROM account
on Thu, 15 Nov 2012 18:24:20 +0100
The Command :

woOutMail:SendUsingAccount := woOutNs:Accounts:Item(2)

does not change the FROM account into the eMail.
does anyone have any idea ?
see below the prg

thanks


------------------------------------------------------
PRG
-----------------------------------------------------



....
#pragma library( "ascom10.lib" )
#include "common.ch"
#include "outlook.ch"
...
...
woOutlook := CreateObject("Outlook.Application")
IF Empty( woOutlook )
   MsgBox( "OutLook non installato su questo PC" )
   CLOSE ALL
   RETURN
ENDIF
woOutMail := woOutlook:CreateItem( olMailItem )
woOutNs   := woOutlook:GetNamespace( "MAPI" )

woOutMail:Display()

 ------------------ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ---------------
 I Have 4 Accounts . The Default is Number 1
 I want to set Account Number 2
 But the command [SendUsingAccount]  does not change the FROM account
!!!!!!!!

 The Account FROM remains to number 1
 Aall other data ( To, CC, .. ecc)  on the e-mails are ok
 ------------------ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ---------------
woOutMail:SendUsingAccount := woOutNs:Accounts:Item(2)

wcInvia="To"
woOutMail:&wcInvia       := "address@gmail.com"

woOutMail:BCC            := "BCC_address@gmail.com"
woOutMail:CC             := "CC_adddress@gmail.com"
woOutMail:Subject        := "Oggetto della MAIL - "  + DTOC( DATE() ) + " -
" + TIME()
woOutMail:Body           := "Corpo"

woOutMail:Display()
woOutlook:Destroy()
...
...
AUGE_ OHRRe: outlook 2010 - does not change the FROM account
on Thu, 15 Nov 2012 19:28:30 +0100
hi,

> woOutMail:SendUsingAccount := woOutNs:Accounts:Item(2)

hm ... i "think" it must be

woOutNs.Session.Accounts.Item(2).SmtpAddress

greetings by OHR
Jimmy
Tiziano PiccininiRe: outlook 2010 - does not change the FROM account
on Tue, 20 Nov 2012 11:07:44 +0100
Thanks for the reply.
Unfortunately, the suggestion does not work.
Reporting under the macro that works correctly into outlook .
As you can see, the command  :
oItem.SendUsingAccount = oOutlookApp.Session.Accounts.Item(2)   
function correctly.
( this command works correctly also into excel's macro ! )


The command :
 oItem.SendUsingAccount = oOutlookApp.Session.Accounts.Item(2).SmtpAddress
compilation error.

However, I tried to compile the program xbase with your suggestion ,
but it did not work.
thanks
T.Piccinini



*************************************************************
   MACRO OUTLOOK
*************************************************************

 Sub SendMailWithOutLook()
 ' Macro into Outlook 2010
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

Set oOutlookApp = GetObject(, "Outlook.Application")
Set oItem = oOutlookApp.CreateItem(olMailItem)

oItem.Display
' ---- OK
oItem.SendUsingAccount = oOutlookApp.Session.Accounts.Item(2)        
' ---- KO = Compilation  ERROR
' oItem.SendUsingAccount = oOutlookApp.Session.Accounts.Item(2).SmtpAddress  
     


With oItem
  .To = "nomeTO@server.it"
  .CC = "nomeCC@server.it"
  .Subject = "E-mail From OutLook Vba"
  .Body = "Hello da VBA"
  '  .SendUsingAccount = oOutlookApp.Session.Accounts.Item(1)
  '  .Display
End With
Set oItem = Nothing
Set oOutlookApp = Nothing
 End Sub
AUGE_ OHRRe: outlook 2010 - does not change the FROM account
on Wed, 21 Nov 2012 04:11:24 +0100
hi,

> ' ---- OK
> oItem.SendUsingAccount = oOutlookApp.Session.Accounts.Item(2)
> ' ---- KO = Compilation  ERROR
> ' oItem.SendUsingAccount = 
> oOutlookApp.Session.Accounts.Item(2).SmtpAddress

in your 1st Msg you wrote "woOutNs:Accounts:Item(2)" missing "Session"
which seems to work without "SmtpAddress" ( is it a POP3 Account ) ?

remember to replace "." with Xbase++ Syntax ":"

   woOutMail:SendUsingAccount := woOutNs:Session:Accounts:Item(2)

greetings by OHR
Jimmy
Willy MollersRe: outlook 2010 - does not change the FROM account
on Sun, 11 Mar 2018 08:17:25 +0100
Hi Tiziano,

I have the same problem!
Have you found a solution?

Thanks

Willy





"Tiziano Piccinini" schrieb im Newsbeitrag 
news:6cdfd284$5ff477e0$28ac8@news.alaska-software.com...

The Command :

woOutMail:SendUsingAccount := woOutNs:Accounts:Item(2)

does not change the FROM account into the eMail.
does anyone have any idea ?
see below the prg

thanks


------------------------------------------------------
PRG
-----------------------------------------------------



....
#pragma library( "ascom10.lib" )
#include "common.ch"
#include "outlook.ch"
...
...
woOutlook := CreateObject("Outlook.Application")
IF Empty( woOutlook )
   MsgBox( "OutLook non installato su questo PC" )
   CLOSE ALL
   RETURN
ENDIF
woOutMail := woOutlook:CreateItem( olMailItem )
woOutNs   := woOutlook:GetNamespace( "MAPI" )

woOutMail:Display()

 ------------------ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ---------------
 I Have 4 Accounts . The Default is Number 1
 I want to set Account Number 2
 But the command [SendUsingAccount]  does not change the FROM account
!!!!!!!!

 The Account FROM remains to number 1
 Aall other data ( To, CC, .. ecc)  on the e-mails are ok
 ------------------ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ---------------
woOutMail:SendUsingAccount := woOutNs:Accounts:Item(2)

wcInvia="To"
woOutMail:&wcInvia       := "address@gmail.com"

woOutMail:BCC            := "BCC_address@gmail.com"
woOutMail:CC             := "CC_adddress@gmail.com"
woOutMail:Subject        := "Oggetto della MAIL - "  + DTOC( DATE() ) + " -
" + TIME()
woOutMail:Body           := "Corpo"

woOutMail:Display()
woOutlook:Destroy()
...
...