简体   繁体   English

没有从Excel-VBA发送电子邮件的权限

[英]No permissions to send email from Excel-VBA

I used to send email from VBA from an Excel Workbook. 我曾经从Excel工作簿从VBA发送电子邮件。 This worked correct. 这是正确的。 Now I have a new PC and tried to run the same code. 现在,我有一台新的PC,并尝试运行相同的代码。 And I get a permission error. 而且我得到一个权限错误。 I have checked, re-checked and double checked with my old PC, but I can't find any difference in settings. 我已经使用旧PC进行了检查,重新检查和再次检查,但是设置没有任何区别。 Not in Excel, nor in Outlook. 不在Excel中,也不在Outlook中。 Here is the mail I get when I try to send the mail (I just masked my email address with xxx@yyy,.nl). 这是我尝试发送邮件时收到的邮件(我只是用xxx @ yyy,.nl屏蔽了我的电子邮件地址)。

Ntired everyting … nothing works … 疲倦的每一刻……什么都行不通……

Sender = "<Support> support@xxx.com"

Set objMail = objOl.CreateItem(0)
With objMail
    .Sentonbehalfofname = Sender
    .Subject = qrySubj
    .HTMLBody = "<HTML><BODY>" & Text & "</BODY></HTML>"
    .DeleteAfterSubmit = False
    .To = Receiver
    .Send
End With

On my old PC the mail is sent. 在我的旧PC上,邮件已发送。 On my new PC i get: 在我的新PC上,我得到:

Uw bericht heeft enkele of alle geadresseerden niet bereikt. Uw bericht heeft enkele of alle geadresseerden niet bereikt。

  Onderwerp:    Dagelijkse rapportage mails
  Verzonden:    13-8-2019 07:54

De volgende geadresseerde(n) zijn niet bereikt: 德意志民族解放运动:

  'xxx@yyy.nl' op 13-8-2019 07:54
        Dit bericht is niet verzonden. U bent niet gemachtigd om het bericht namens de opgegeven gebruiker te verzenden. 

Diagnostische gegevens voor beheerders: 诊断贝格犬:


Fout is [0x80070005-0x000004dc-0x00000524]. Fout为[0x80070005-0x000004dc-0x00000524]。

Exchange-antwoordheaders: request-id: 09cc6cb4-af3f-4613-ac6a-4bb18046bd0e X-ServerApplication: Exchange/15.20.2157.000 X-FEServer: AM0PR02CA0053 X-BEServer: AM0PR08MB4387 X-CalculatedBETarget: AM0PR08MB4387.eurprd08.prod.outlook.com X-RequestId: {F6762D9D-3507-476D-93ED-008D1A05C6A3}:108 X-ClientInfo: {17B3EEB2-65A2-4317-8132-4E5BAD253A55}:241960014 X-ElapsedTime: 1430 X-BackEndHttpStatus: 200 X-ResponseCode: 0 X-DiagInfo: AM0PR08MB4387 X-RequestType: Execute Exchange-antwoordheaders:请求ID:09cc6cb4-af3f-4613-ac6a-4bb18046bd0e X-Server应用程序:Exchange / 15.20.2157.000 X-FEServer:AM0PR02CA0053 X-BEServer:AM0PR08MB4387 X-CalculatedBETarget:AM0PR08MB4387.eurprd08.prod.outlook。 -RequestId:{F6762D9D-3507-476D-93ED-008D1A05C6A3}:108 X-ClientInfo:{17B3EEB2-65A2-4317-8132-4E5BAD253A55}:241960014 X-ElapsedTime:1430 X-BackEndHttpStatus:200 X-ResponseCode:0 X- DiagInfo:AM0PR08MB4387 X-RequestType:执行


Overzicht van externe bewerkingen: Overzicht van externe Bewerkingen:

0: ropWriteStream (45) Verwerkt(1) Voltooid(0)
    Resultaat van externe bewerkingen: 0
    Reactiecodes: 0
1: ropRelease (1) Verwerkt(1) Voltooid(0)
    Resultaat van externe bewerkingen: 0
    Reactiecodes: 0
2: ropSetProps (10) Verwerkt(1) Voltooid(0)
    Resultaat van externe bewerkingen: 0
    Reactiecodes: 0
3: ropFlushRecipients (14) Verwerkt(1) Voltooid(0)
    Resultaat van externe bewerkingen: 0
    Reactiecodes: 0
4: ropSetProps (10) Verwerkt(1) Voltooid(0)
    Resultaat van externe bewerkingen: 0
    Reactiecodes: 0
5: ropTransportSend (74) Verwerkt(1) Voltooid(0)
    Resultaat van externe bewerkingen: 0
    Reactiecodes: 1244

Uitzonderingen bij reacties: Uitzonderingen bij反应:

Index van externe bewerkingen: 5 Gekoppelde externe bewerkingen: ropTransportSend (74) Microsoft.Exchange.Data.Storage.SendAsDeniedException: Can't transport send message. 外部索引:5外部索引:ropTransportSend(74)Microsoft.Exchange.Data.Storage.SendAsDeniedException:无法传输发送消息。 ---> Microsoft.Mapi.MapiExceptionSendAsDenied: MapiExceptionSendAsDenied: Unable to transport send message. ---> Microsoft.Mapi.MapiExceptionSendAsDenied:MapiExceptionSendAsDenied:无法传输发送消息。 (hr=0x80070005, ec=1244) Diagnostic context: Lid: 35250 (hr = 0x80070005,ec = 1244)诊断上下文:盒盖:35250
Lid: 36674 dwParam: 0xA Lid: 61250 dwParam: 0x0 Lid: 45378 dwParam: 0x2 Lid: 44866 dwParam: 0x46C Lid: 36674 dwParam: 0xE Lid: 61250 dwParam: 0x0 Lid: 45378 dwParam: 0x471 Lid: 44866 dwParam: 0x236 Lid: 55847 EMSMDBPOOL.EcPoolSessionDoRpc called [length=1049] Lid: 43559 EMSMDBPOOL.EcPoolSessionDoRpc returned [ec=0x0][length=148][latency=0] Lid: 52176 ClientVersion: 15.20.2157.0 Lid: 50032 ServerVersion: 15.20.2157.6000 Lid: 35180 盖子:36674 dwParam:0xA盖子:61250 dwParam:0x0盖子:45378 dwParam:0x2盖子:44866 dwParam:0x46C盖子:36674 dwParam:0xE盖子:61250 dwParam:0x0盖子:45378 dwParam :: 44x00盖子55847 EMSMDBPOOL.EcPoolSessionDoRpc被称为[length = 1049]盖子:43559 EMSMDBPOOL.EcPoolSessionDoRpc返回了[ec = 0x0] [length = 148] [latency = 0]盖子:52176 ClientVersion:15.20.2157.0盖子:50032 ServerVersion:15.20.2157.6000 Lid: 35180
Lid: 23226 --- ROP Parse Start --- Lid: 27962 ROP: ropSetProps [10] Lid: 27962 ROP: ropFlushRecipients [14] Lid: 31418 --- ROP Parse Done --- Lid: 35250 盖子:23226 --- ROP解析开始---盖子:27962 ROP:ropSetProps [10]盖子:27962 ROP:ropFlushRecipients [14]盖子:31418 --- ROP Parse Done ---盖子:35250
Lid: 36674 dwParam: 0xA Lid: 61250 dwParam: 0x0 Lid: 45378 dwParam: 0x2 Lid: 44866 dwParam: 0x46 Lid: 36674 dwParam: 0x4A Lid: 61250 dwParam: 0x0 Lid: 45378 dwParam: 0x4B Lid: 44866 dwParam: 0x0 Lid: 55847 EMSMDBPOOL.EcPoolSessionDoRpc called [length=172] Lid: 43559 EMSMDBPOOL.EcPoolSessionDoRpc returned [ec=0x0][length=368][latency=0] Lid: 52176 ClientVersion: 15.20.2157.0 Lid: 50032 ServerVersion: 15.20.2157.6000 Lid: 35180 盒盖:36674 dwParam:0xA盒盖:61250 dwParam:0x0盒盖:45378 dwParam:0x2盒盖:44866 dwParam:0x46盒盖:36674 dwParam:0x4A盒盖:61250 dwParam:0x0盒盖:45378 dwBamd :: 4416 dwBamd:0x4 55847 EMSMDBPOOL.EcPoolSessionDoRpc被称为[length = 172]盖子:43559 EMSMDBPOOL.EcPoolSessionDoRpc返回了[ec = 0x0] [length = 368] [latency = 0]盖子:52176 ClientVersion:15.20.2157.0盖子:50032 ServerVersion:15.20.2157.6000盖子: 35180
Lid: 23226 --- ROP Parse Start --- Lid: 27962 ROP: ropSetProps [10] Lid: 27962 ROP: ropTransportSend [74] Lid: 17082 ROP Error: 0x4DC 盖子:23226 --- ROP解析开始---盖子:27962 ROP:ropSetProps [10]盖子:27962 ROP:ropTransportSend [74]盖子:17082 ROP错误:0x4DC
Lid: 44949 盖:44949
Lid: 21921 StoreEc: 0x4DC 盒盖:21921 StoreEc:0x4DC
Lid: 27962 ROP: ropExtendedError [250] Lid: 1494 ---- Remote Context Beg ---- Lid: 38698 盖子:27962 ROP:ropExtendedError [250]盖子:1494 ----远程上下文请求----盖子:38698
Lid: 37692 盖:37692
Lid: 37948 盖:37948
Lid: 33852 dwParam: 0x0 Msg: SMTP Lid: 56248 StoreEc: 0x4DC 盖子:33852 dw参数:0x0消息:SMTP盖子:56248 StoreEc:0x4DC
Lid: 40748 qdwParam: 0xB01000000000001 Lid: 57132 qdwParam: 0x0 盒盖:40748 qdw参数:0xB01000000000001盒盖:57132 qdw参数:0x0
Lid: 63016 dwParam: 0x4A Lid: 39640 StoreEc: 0x4DC 盒盖:63016 dw参数:0x4A盒盖:39640 StoreEc:0x4DC
Lid: 45434 Guid: 00011788-362d-8c85-0000-000000000000 Lid: 10786 dwParam: 0x0 Msg: 15.20.2157.000:AM0PR08MB4387:74f6b60d-ca04-46c4-80ff-8a31bf2a4ef7 Lid: 1750 ---- Remote Context End ---- Lid: 31418 --- ROP Parse Done --- Lid: 22753 盖:45434盖:00011788-362d-8c85-0000-000000000000盖:10786 dwParam:0x0消息:15.20.2157.000:AM0PR08MB4387:74f6b60d-ca04-46c4-80ff-8a31bf2a4ef7盖:1750 ----远程上下文结束--- -盖子:31418 ---完成ROP分析---盖子:22753
Lid: 21817 ROP Failure: 0x4DC 盒盖:21817 ROP失败:0x4DC
Lid: 59285 盖:59285
Lid: 46997 StoreEc: 0x4DC 盒盖:46997 StoreEc:0x4DC
at Microsoft.Mapi.MapiExceptionHelper.ThrowIfError(String message, Int32 hresult, IExInterface iUnknown, Exception innerException, MapiStore mapiStore) at Microsoft.Mapi.MapiBase.ThrowIfError(String message, Int32 hr) at Microsoft.Mapi.MapiMessage.TransportSendMessage(PropValue[]& propsToReturn) at Microsoft.Exchange.Data.Storage.MapiAccessor.TransportSendMessage(Object mapiObject, ExTimeZone timezone, PropertyDefinition[]& propertyDefinitions, Object[]& propertyValues) --- End of inner exception stack trace --- at Microsoft.Exchange.Data.Storage.MapiAccessor.TransportSendMessage(Object mapiObject, ExTimeZone timezone, PropertyDefinition[]& propertyDefinitions, Object[]& propertyValues) at Microsoft.Exchange.Data.Storage.CoreItem.TransportSend(PropertyDefinition[]& properties, Object[]& values) at Microsoft.Exchange.RpcClientAccess.Handler.Message.TransportSend() at Microsoft.Exchange.RpcClientAccess.Handler.RopHandler.<>c__DisplayClass154_0.b__0() at Microsoft.Exchange.RpcClientAccess 在Microsoft.Mapi.MapiBase.ThrowIfError(字符串消息,Int32 hr)在Microsoft.Mapi.Mapi.MapiExceptionHelper.ThrowIfError(String message,Int32 hresult,IExInterface iUnknown,Exception innerException,MapiStore mapiStore)在Microsoft.Mapi.MapiMessage.TransportSendMessage(PropValue [ ]&propsToReturn)Microsoft.Exchange.Data.Storage.MapiAccessor.TransportSendMessage(Object mapiObject,ExTimeZone时区,PropertyDefinition []&propertyDefinitions,Object []&propertyValues)---内部异常堆栈跟踪的结尾---在Microsoft。 Exchange.Data.Storage.MapiAccessor.TransportSendMessage(Object mapiObject,ExTimeZone时区,PropertyDefinition []&propertyDefinitions,Object []&propertyValues)在Microsoft.Exchange.Data.Storage.CoreItem.TransportSend(PropertyDefinition []&属性,Object []和值)在Microsoft.Exchange.RpcClientAccess.Handler.Message.TransportSend()在Microsoft.Exchange.RpcClientAccess.Handler.RopHandler。<> c__DisplayClass154_0.b__0()在Microsoft.Exchange.RpcClientAccess .Handler.ExceptionTranslator.TryExecuteCatchAndTranslateExceptions[TResult](Func 1 protectedCode, Func 2 errorCodeExtractor, Boolean noThrow, TResult& result, Exception& exception, ErrorCode& errorCode) .Handler.ExceptionTranslator.TryExecuteCatchAndTranslateExceptions [TResult](Func 1 protectedCode, Func 2 errorCodeExtractor,Boolean noThrow,TResult&结果,Exception&异常,ErrorCode&errorCode)

Transportverzending is mislukt: foutopsomming(25), HResult(0x00000000), EC(1244). Transportverzending错误:foutopsomming(25),HResult(0x00000000),EC(1244)。 Transportverzending is mislukt: foutopsomming(22), HResult(0x00000000), EC(1244). Transportverzending错误:foutopsomming(22),HResult(0x00000000),EC(1244)。 Berichtverzending is mislukt: bericht-id(4), foutopsomming(13), HResult(0x80070005), EC(1244). Berichtverzending错误:bericht-id(4),foutopsomming(13),HResult(0x80070005),EC(1244)。

That means you (the current profile user) cannot send on behalf of the specified user. 这意味着您(当前配置文件用户)无法代表指定用户发送。 Try to comment out the line setting the SentoObehalfOfName property and see if the message goes through. 尝试注释掉设置SentoObehalfOfName属性的行,然后查看消息是否通过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM