A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Can't send on behalf of with VBA



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 24th 08, 03:04 PM posted to microsoft.public.outlook.program_vba
Gil
external usenet poster
 
Posts: 12
Default Can't send on behalf of with VBA

When I try to execute the following code from excel I get the messages
returned to me.
with the following message returned back. I can execute the code from
other computers and other accounts without this problem. According to
the server side people all of these accounts are identical so there
should be a problem sending on behalf of. In addition this user can
send on behalf of this address to this person manually, but for some
reason when then VBA runs the emails get sent back to her.

Any ideas?

Thanks,
Gil

Your message did not reach some or all of the intended recipients.

Subject: Biweekly Payroll Time Card Reports
Sent: 5/15/2008 10:19 AM

The following recipient(s) could not be reached:

Blah,Blah on 5/15/2008 10:19 AM
You do not have permission to send to this recipient. For
assistance, contact your system administrator.
MSEXCH:MSExchangeIS:/DC=edu/DC=xxxxx/DC=ad:EXCHANGEB



' Begin Sending Email Process...
For I = 7 To Myrange.Rows.Count
For index = 1 To FinalData.Rows.Count
If Myrange.Cells(I, 1) = FinalData.Cells(index, 4) Then
Set NewMessage = myOlApp.CreateItem(olMailItem)
NewMessage.SentOnBehalfOfName = "
With NewMessage
.Subject = "Biweekly Payroll Time Card Reports"
' Type message to contact here.
.Body = "Dear " & Myrange.Cells(I, 3) & "," & _
"Thank you! "
.To = Myrange.Cells(I, 4)
NewMessage.Attachments.Add (Rate_File & "_" & _
FinalData.Cells(index, 4) & ".doc")
' Send the message to Resume ClickYes
Res = SendMessage(wnd, uClickYes, 1, 0)
' Send Report to department contact
.Send
' Send the message to Suspend ClickYes
Res = SendMessage(wnd, uClickYes, 0, 0)
End With ' NewMessage

Set NewMessage = Nothing
index = FinalData.Rows.Count + 1
End If
Next index
Next I
  #2  
Old July 25th 08, 02:02 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Can't send on behalf of with VBA

Are you sure that the data you're putting into .To is a good email address?
Try getting the Recipients collection of the email item and using the
Recipients.ResolveAll() method and then checking each Recipient object in
the Recipients collection for Recipient.Resolved to make sure you won't get
that error.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Gil" wrote in message
...
When I try to execute the following code from excel I get the messages
returned to me.
with the following message returned back. I can execute the code from
other computers and other accounts without this problem. According to
the server side people all of these accounts are identical so there
should be a problem sending on behalf of. In addition this user can
send on behalf of this address to this person manually, but for some
reason when then VBA runs the emails get sent back to her.

Any ideas?

Thanks,
Gil

Your message did not reach some or all of the intended recipients.

Subject: Biweekly Payroll Time Card Reports
Sent: 5/15/2008 10:19 AM

The following recipient(s) could not be reached:

Blah,Blah on 5/15/2008 10:19 AM
You do not have permission to send to this recipient. For
assistance, contact your system administrator.
MSEXCH:MSExchangeIS:/DC=edu/DC=xxxxx/DC=ad:EXCHANGEB



' Begin Sending Email Process...
For I = 7 To Myrange.Rows.Count
For index = 1 To FinalData.Rows.Count
If Myrange.Cells(I, 1) = FinalData.Cells(index, 4) Then
Set NewMessage = myOlApp.CreateItem(olMailItem)
NewMessage.SentOnBehalfOfName = "
With NewMessage
.Subject = "Biweekly Payroll Time Card Reports"
' Type message to contact here.
.Body = "Dear " & Myrange.Cells(I, 3) & "," & _
"Thank you! "
.To = Myrange.Cells(I, 4)
NewMessage.Attachments.Add (Rate_File & "_" & _
FinalData.Cells(index, 4) & ".doc")
' Send the message to Resume ClickYes
Res = SendMessage(wnd, uClickYes, 1, 0)
' Send Report to department contact
.Send
' Send the message to Suspend ClickYes
Res = SendMessage(wnd, uClickYes, 0, 0)
End With ' NewMessage

Set NewMessage = Nothing
index = FinalData.Rows.Count + 1
End If
Next index
Next I


  #3  
Old July 25th 08, 02:10 PM posted to microsoft.public.outlook.program_vba
Gil
external usenet poster
 
Posts: 12
Default Can't send on behalf of with VBA

I can run the same code with the same source data from my pc with
office 2007 and not receive the error. I will add the code to resolve
the recipients though.

-Gil




On Jul 25, 9:02*am, "Ken Slovak - [MVP - Outlook]"
wrote:
Are you sure that the data you're putting into .To is a good email address?
Try getting the Recipients collection of the email item and using the
Recipients.ResolveAll() method and then checking each Recipient object in
the Recipients collection for Recipient.Resolved to make sure you won't get
that error.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm

"Gil" wrote in message

...



When I try to execute the following code from excel I get the messages
returned to me.
with the following message returned back. I can execute the code from
other computers and other accounts without this problem. According to
the server side people all of these accounts are identical so there
should be a problem sending on behalf of. In addition this user can
send on behalf of this address to this person manually, but for some
reason when then VBA runs the emails get sent back to her.


Any ideas?


Thanks,
Gil


Your message did not reach some or all of the intended recipients.


* * *Subject: * * * * * *Biweekly Payroll Time Card Reports
* * *Sent: * * * * * * * * 5/15/2008 10:19 AM


The following recipient(s) could not be reached:


* * *Blah,Blah on 5/15/2008 10:19 AM
* * * * * *You do not have permission to send to this recipient. *For
assistance, contact your system administrator.
* * * * * *MSEXCH:MSExchangeIS:/DC=edu/DC=xxxxx/DC=ad:EXCHANGEB


* *' Begin Sending Email Process...
* *For I = 7 To Myrange.Rows.Count
* * * *For index = 1 To FinalData.Rows.Count
* * * * * * If Myrange.Cells(I, 1) = FinalData.Cells(index, 4) Then
* * * * * * * * * Set NewMessage = myOlApp.CreateItem(olMailItem)
* * * * * * * * * NewMessage.SentOnBehalfOfName = "
* * * * * * * * * With NewMessage
* * * * * * * * * * * .Subject = "Biweekly Payroll Time Card Reports"
* * * * * * * * * * * ' Type message to contact here.
* * * * * * * * * * * .Body = "Dear " & Myrange..Cells(I, 3) & "," & _
* * * * * * * * * * * * * * * "Thank you! "
* * * * * * * * * * * .To = Myrange.Cells(I, 4)
* * * * * * * * * * * NewMessage.Attachments.Add (Rate_File & "_" & _
* * * * * * * * * * * * * *FinalData.Cells(index, 4) & ".doc")
* * * * * * * * * * * ' Send the message to Resume ClickYes
* * * * * * * * * * * Res = SendMessage(wnd, uClickYes, 1, 0)
* * * * * * * * * * * ' Send Report to department contact
* * * * * * * * * * * .Send
* * * * * * * * * * * ' Send the message to Suspend ClickYes
* * * * * * * * * * * Res = SendMessage(wnd, uClickYes, 0, 0)
* * * * * * * * * End With ' NewMessage


* * * * * * * * * Set NewMessage = Nothing
* * * * * * * * * index = FinalData.Rows.Count + 1
* * * * * * End If
* * * *Next index
* *Next I- Hide quoted text -


- Show quoted text -

  #4  
Old August 4th 08, 09:54 PM posted to microsoft.public.outlook.program_vba
Gil
external usenet poster
 
Posts: 12
Default Can't send on behalf of with VBA

On Jul 25, 9:10*am, Gil wrote:
I can run the same code with the same source data from my pc with
office 2007 and not receive the error. I will add the code to resolve
the recipients though.

-Gil

On Jul 25, 9:02*am, "Ken Slovak - [MVP - Outlook]"



wrote:
Are you sure that the data you're putting into .To is a good email address?
Try getting the Recipients collection of the email item and using the
Recipients.ResolveAll() method and then checking each Recipient object in
the Recipients collection for Recipient.Resolved to make sure you won't get
that error.


--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm


"Gil" wrote in message


...


When I try to execute the following code from excel I get the messages
returned to me.
with the following message returned back. I can execute the code from
other computers and other accounts without this problem. According to
the server side people all of these accounts are identical so there
should be a problem sending on behalf of. In addition this user can
send on behalf of this address to this person manually, but for some
reason when then VBA runs the emails get sent back to her.


Any ideas?


Thanks,
Gil


Your message did not reach some or all of the intended recipients.


* * *Subject: * * * * * *Biweekly Payroll Time Card Reports
* * *Sent: * * * * * * * * 5/15/2008 10:19 AM


The following recipient(s) could not be reached:


* * *Blah,Blah on 5/15/2008 10:19 AM
* * * * * *You do not have permission to send to this recipient. *For
assistance, contact your system administrator.
* * * * * *MSEXCH:MSExchangeIS:/DC=edu/DC=xxxxx/DC=ad:EXCHANGEB


* *' Begin Sending Email Process...
* *For I = 7 To Myrange.Rows.Count
* * * *For index = 1 To FinalData.Rows.Count
* * * * * * If Myrange.Cells(I, 1) = FinalData.Cells(index, 4) Then
* * * * * * * * * Set NewMessage = myOlApp.CreateItem(olMailItem)
* * * * * * * * * NewMessage.SentOnBehalfOfName = "
* * * * * * * * * With NewMessage
* * * * * * * * * * * .Subject = "Biweekly Payroll Time Card Reports"
* * * * * * * * * * * ' Type message to contact here.
* * * * * * * * * * * .Body = "Dear " & Myrange.Cells(I, 3) & "," & _
* * * * * * * * * * * * * * * "Thank you! "
* * * * * * * * * * * .To = Myrange.Cells(I, 4)
* * * * * * * * * * * NewMessage.Attachments.Add (Rate_File & "_" & _
* * * * * * * * * * * * * *FinalData.Cells(index, 4) & ".doc")
* * * * * * * * * * * ' Send the message to Resume ClickYes
* * * * * * * * * * * Res = SendMessage(wnd, uClickYes, 1, 0)
* * * * * * * * * * * ' Send Report to department contact
* * * * * * * * * * * .Send
* * * * * * * * * * * ' Send the message to Suspend ClickYes
* * * * * * * * * * * Res = SendMessage(wnd, uClickYes, 0, 0)
* * * * * * * * * End With ' NewMessage


* * * * * * * * * Set NewMessage = Nothing
* * * * * * * * * index = FinalData.Rows.Count + 1
* * * * * * End If
* * * *Next index
* *Next I- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Problem resolved. The client was running in cache mode. Once I
disabled that the messages sent successfully. Being ignorant of cache
mode, why would that cause the emails to bounce back?

Thanks,
Gil
  #5  
Old August 5th 08, 02:27 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Can't send on behalf of with VBA

It shouldn't that I know of. I use cached mode here and haven't seen
anything like that.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Gil" wrote in message
...
On Jul 25, 9:10 am, Gil wrote:
snip
Problem resolved. The client was running in cache mode. Once I
disabled that the messages sent successfully. Being ignorant of cache
mode, why would that cause the emails to bounce back?

Thanks,
Gil

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send a msg on behalf of someone Anita Outlook - Calandaring 1 August 14th 07 04:41 PM
how use SEND BEHALF France Outlook - Installation 2 July 9th 07 09:46 PM
How to send on behalf of using VBA Bob Fishel Outlook and VBA 2 June 14th 07 08:02 PM
send behalf Nicolai Outlook - General Queries 1 September 10th 06 08:20 PM
send on behalf BINZA@ Outlook - General Queries 3 February 8th 06 03:30 AM


All times are GMT +1. The time now is 10:36 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.