+34 911 599 883

+34 911 895 172

Cambiar la cuenta predeterminada para enviar emails en Outlook utilizando una cuenta delegada Exchange

Si estamos utilizando una cuenta Exchange en Outlook y necesitamos enviar por defecto con otra cuenta de correo Exchange sobre la que tenemos los permisos de enviar como o enviar en nombre de, podemos utilizar este script para cambiar la cuenta por defecto de envío:

'=================================================================
'Description: Outlook macro to automatically set a different
' From address.
'
'Comment: You can set the email address at the bottom of the code.
' Uncomment the myOlExp_InlineResponse sub to also make it
' work with the Reading Pane reply feature of Outlook 2013/2016/365.
'
' author : Robert Sparnaaij
' version: 1.1
' website: https://www.howto-outlook.com/howto/setfromaddress.htm
'=================================================================
Dim WithEvents objInspectors As Outlook.Inspectors
Dim WithEvents objMailItem As Outlook.MailItem
Dim WithEvents myOlExp As Outlook.Explorer
Private Sub Application_Startup()
Initialize_handler
End Sub
Public Sub Initialize_handler()
Set objInspectors = Application.Inspectors
Set myOlExp = Application.ActiveExplorer
End Sub
Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Class = olMail Then
Set objMailItem = Inspector.CurrentItem
If objMailItem.Sent = False Then
Call SetFromAddress(objMailItem)
End If
End If
End Sub
'Uncomment the next 3 lines to enable Outlook 2013/2016/365 Reading Pane Reply
'Private Sub myOlExp_InlineResponse(ByVal objItem As Object)
' Call SetFromAddress(objItem)
'End Sub
Public Sub SetFromAddress(oMail As Outlook.MailItem)
' Set your preferred default From address below.
' Exchange permissions determine if it is actually stamped
' as "Sent On Behalf Of" or "Sent As".
' The address is not properly updated for the InlineResponse
' feature in Outlook 2013/2016/365. This is only a visual bug.
oMail.SentOnBehalfOfName = "correo@dominio.es"
End Sub

Este script lo pegaremos en el editor de VB de Outlook, se abre pulsando ALT+F11, pegamos el código y lo guardamos.

Y también tendremos que o bien firmar el script o bien bajar la seguridad de Outlook para que ejecute el script sin firmar, ya que de otro modo aparecerá siempre que abramos el Outlook una ventana avisando sobre la ejecución de la macro.

 

FUENTE: https://www.howto-outlook.com/howto/setfromaddress.htm