Sending a email using an account setup for the process sending the

C

Cyberwolf

I have an access database that sends emails out on a regular basis. It was
decided to keep track of these emails, that a new exchange account should be
setup. I am not trying how to figure out how to send and email through that
account. I would imagine it would require signing into this account before
send the email and then logging out of it. I have not been able to find any
coding samples to do this.

We are using a mix of Outlook 2003 and 2007 so it would probably have to be
done with late binding or writing code to see which version is on the
particular machine sending the email

--
Cyberwolf
Finder of Paths, Hunter of Prey
Ghost of the Night, Shadow of Day
The Wolf
Office 2003 SP3 on Win XP Pro SP2 using outlook 2003 & 2007.
 
S

SvenC

Hi Cyberwolf,
I have an access database that sends emails out on a regular basis. It
was
decided to keep track of these emails, that a new exchange account should
be
setup. I am not trying how to figure out how to send and email through
that
account. I would imagine it would require signing into this account
before
send the email and then logging out of it. I have not been able to find
any
coding samples to do this.

We are using a mix of Outlook 2003 and 2007 so it would probably have to
be
done with late binding or writing code to see which version is on the
particular machine sending the email

How are you currently sending the mails?
How does that sending solution set the sender address of the mails?

If the sender does not matter for the recipients you could just keep your
current solution and add the new Exchange mailbox as BCC recipient.
 
C

Cyberwolf

currently we are having a problem where some of the useres are on the OWA
version, and I am getting Outlook installed on their pc's. But we would also
like to see the email being sent from that account. That way we can track
any outgoing emails easily to see what time it was actually sent out
according to the sent folder.
 
S

SvenC

Cyberwolf said:
currently we are having a problem where some of the useres are on the OWA
version, and I am getting Outlook installed on their pc's. But we would
also
like to see the email being sent from that account. That way we can track
any outgoing emails easily to see what time it was actually sent out
according to the sent folder.

Again: how do you currently send those mails. Maybe you can
change your current approach which could cause less trouble
than searching a completely new way.

Sending mails automatically with the Outlook Object Model
will typically cause security dialog pop ups which is obviously
not good for an automatic process.
 
C

Cyberwolf

Currently I am using htis code to send emails with pdf attachements

Const oMailItem As Long = 0

Public Function SendMail(DisplayMsg As Boolean, strTo As String, strSubject
As String, strBody As String, Optional strAttachPathFile As String, Optional
strCC As String, Optional strBCC As String)


Dim objOutlook As Object
Dim objOutlookMsg As Object
Dim objOutlookRecip As Object
Dim objOutlookAttach As Object
'Dim objOutlook As Outlook.Application
'Dim objOutlookMsg As Outlook.MailItem
'Dim objOutlookRecip As Outlook.Recipient
'Dim objOutlookAttach As Outlook.Attachment
'Dim oOutlook As Object
'Dim omail As Object

'Set oOutlook = CreateObject("Outlook.Application")
'Set omail = oOutlook.CreateItem(olMailItem)

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(oMailItem)
With objOutlookMsg


'Add "To" recipient
'Set objOutlookRecip = .Recipients.Add(strTo)
'objOutlookRecip.Type = olTo
.To = strTo
'.SentOnBehalfOfName = "RAMP"
'"Add "CC" recipient
If strCC <> "" Then
.CC = strCC
End If

'Add "BCC" recipient
If strBCC <> "" Then
..BCC = strBCC
End If

'Add subject, body, and importance of the E-Mail Messzage
objOutlookMsg.Subject = strSubject
objOutlookMsg.Body = strBody
'objOutlookMsg.Importance =

'Add Attachment
If strAttachPathFile <> "" Then
objOutlookMsg.Attachments.Add strAttachPathFile, 1
' .Attachments.Add (strAttachPathFile)
End If

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next objOutlookRecip
objOutlookMsg.Send
End With

Set objOutlookMsg = Nothing
objOutlook.Quit
Set objOutlook = Nothing

End Function

I was hoping to modifiy this code to suit my needs
 
S

SvenC

Hi Cyberwolf,
Currently I am using htis code to send emails with pdf attachements
...
.To = strTo
'.SentOnBehalfOfName = "RAMP"
'"Add "CC" recipient
If strCC <> "" Then
.CC = strCC
End If
I was hoping to modifiy this code to suit my needs

So is it important to you that your new special mailbox is seen as
the sender or do you just need a mailbox which gets a copy of your
automatically sent items?

If a copy is enough: just add the special mailbox as .CC or .BCC.

If you need to "send as" that new mailbox and the code is running
on the client machines with the client accounts then you need to
give all clients "send-as" rights to that special mailbox. That can be
quite some work for your admins - not sure if that is worth it.

And I am not sure if the Outlook Object Model allows to change
sender property if you have the send-as right.

Might be a question for Ken or Sue?
 
C

Cyberwolf

Basically we would need to set the group email up on the pc's that need it
and then I control which account the mail is sent from through my code, using
something like .sentonbehalfof?
 
K

Ken Slovak - [MVP - Outlook]

If the logged in user has Send As permissions for the target sending mailbox
then setting SentOnBehalfOfName() will do what you want. Set that property
to the email address of the mailbox alias and send the item.
 
C

Cyberwolf

Thanks Ken.
--
Cyberwolf
Finder of Paths, Hunter of Prey
Ghost of the Night, Shadow of Day
The Wolf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top