【问题标题】:No permissions to send email from Excel-VBA没有权限从 Excel-VBA 发送电子邮件
【发布时间】:2019-08-14 03:32:17
【问题描述】:

我曾经通过 Excel 工作簿从 VBA 发送电子邮件。这工作正确。 现在我有一台新电脑并尝试运行相同的代码。我得到一个权限错误。 我用我的旧电脑检查、重新检查和仔细检查,但我找不到任何设置差异。不在 Excel 中,也不在 Outlook 中。 这是我尝试发送邮件时收到的邮件(我只是用 xxx@yyy,.nl 掩盖了我的电子邮件地址)。

一切都累了……没有任何作用……

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

在我的旧电脑上发送邮件。在我的新电脑上,我得到:

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 是 [0x80070005-0x000004dc-0x00000524]。

交换-antwoodheaders: 请求 ID:09cc6cb4-af3f-4613-ac6a-4bb18046bd0e X-Server应用程序:Exchange/15.20.2157.000 X-FE服务器:AM0PR02CA0053 X-BE 服务器: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: 执行


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 反应:

指数范外部bewerkingen:5 Gekoppelde externe bewerkingen: ropTransportSend (74) Microsoft.Exchange.Data.Storage.SendAsDeniedException:无法传输发送消息。 ---> Microsoft.Mapi.MapiExceptionSendAsDenied:MapiExceptionSendAsDenied:无法传输发送消息。 (hr=0x80070005, ec=1244) 诊断上下文: 盖子:35250
盖子:36674 dwParam:0xA 盖子:61250 dwParam:0x0 盖子:45378 dwParam:0x2 盖子:44866 dwParam:0x46C 盖子:36674 dwParam:0xE 盖子:61250 dwParam:0x0 盖子:45378 dwParam:0x471 盖子:44866 dwParam:0x236 盖子:55847 EMSMDBPOOL.EcPoolSessionDoRpc 称为 [长度=1049] 盖子:43559 EMSMDBPOOL.EcPoolSessionDoRpc 返回 [ec=0x0][length=148][latency=0] 盖子:52176 客户端版本:15.20.2157.0 盖子:50032 服务器版本:15.20.2157.6000 盖子:35180
盖子:23226 --- ROP 解析开始 --- 盖子:27962 ROP:ropSetProps [10] 盖子:27962 ROP:ropFlushRecipients [14] 盖子:31418 --- ROP 解析完成 --- 盖子:35250
盖子:36674 dwParam:0xA 盖子:61250 dwParam:0x0 盖子:45378 dwParam:0x2 盖子:44866 dwParam:0x46 盖子:36674 dwParam:0x4A 盖子:61250 dwParam:0x0 盖子:45378 dwParam:0x4B 盖子:44866 dwParam:0x0 盖子:55847 EMSMDBPOOL.EcPoolSessionDoRpc 调用 [长度=172] 盖子:43559 EMSMDBPOOL.EcPoolSessionDoRpc 返回 [ec=0x0][length=368][latency=0] 盖子:52176 客户端版本:15.20.2157.0 盖子:50032 服务器版本:15.20.2157.6000 盖子:35180
盖子:23226 --- ROP 解析开始 --- 盖子:27962 ROP:ropSetProps [10] 盖子:27962 ROP:ropTransportSend [74] 盖子:17082 ROP 错误:0x4DC
盖子:44949
盖子:21921 StoreEc:0x4DC
盖子:27962 ROP:ropExtendedError [250] 盖子:1494 ----远程上下文请求---- 盖子:38698
盖子:37692
盖子:37948
盖子:33852 dwParam:0x0 消息:SMTP 盖子:56248 StoreEc:0x4DC
盖子:40748 qdw参数:0xB01000000000001 盖子:57132 qdwParam:0x0
盖子:63016 dwParam:0x4A 盖子:39640 StoreEc:0x4DC
盖子:45434 导轨:00011788-362d-8c85-0000-000000000000 盖子:10786 dwParam:0x0 消息:15.20.2157.000:AM0PR08MB4387:74f6b60d-ca04-46c4-80ff-8a31bf2a4ef7 盖子:1750 ----远程上下文结束---- 盖子:31418 --- ROP 解析完成 --- 盖子:22753
盖子:21817 ROP 故障:0x4DC
盖子:59285
盖子:46997 StoreEc:0x4DC
在 Microsoft.Mapi.MapiExceptionHelper.ThrowIfError(字符串消息,Int32 hresult,IExInterface iUnknown,异常 innerException,MapiStore mapiStore) 在 Microsoft.Mapi.MapiBase.ThrowIfError(字符串消息,Int32 小时) 在 Microsoft.Mapi.MapiMessage.TransportSendMessage(PropValue[]& propsToReturn) 在 Microsoft.Exchange.Data.Storage.MapiAccessor.TransportSendMessage(对象 mapiObject、ExTimeZone 时区、PropertyDefinition[]&propertyDefinitions、Object[]&propertyValues) --- 内部异常堆栈跟踪结束 --- 在 Microsoft.Exchange.Data.Storage.MapiAccessor.TransportSendMessage(对象 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](Func1 protectedCode, Func2 errorCodeExtractor, Boolean noThrow, TResult& result, Exception& exception, ErrorCode& errorCode)

Transportverzending 错误:foutopsomming(25)、HResult(0x00000000)、EC(1244)。 Transportverzending 是错误的:fotopsomming(22)、HResult(0x00000000)、EC(1244)。 Berichtverzending 是错误的:bericht-id(4)、foutopsomming(13)、HResult(0x80070005)、EC(1244)。

【问题讨论】:

  • 请将您的问题完全翻译成英文。还要设置您的语言设置,以便错误堆栈也可以用英语阅读,谢谢
  • 怎么做?不知道如何更改语言设置。对不起

标签: excel vba outlook


【解决方案1】:

这意味着您(当前配置文件用户)不能代表指定用户发送邮件。尝试注释掉设置SentoObehalfOfName属性的行,看看消息是否通过。

【讨论】:

  • 感谢您的回复。我这样做了,但随后邮件是从我的 hotmail 帐户 (Exchange) 而不是我的公司帐户 (xxx@bid72.com) 发送的,即使我将我的公司帐户设置为默认帐户。
  • 然而,你把我引向了正确的方向。然后我删除了我的 Hotmail 帐户。我又试了一次,效果很好。我添加了我的 Hotmail 帐户,它仍然可以正常工作。你让我今天一整天都感觉很好。非常感谢。
  • 那是因为 Hotmail 不再是您的默认帐户。 SentoObehalfOfName 只能设置为来自创建邮件的同一 Exchange 组织的名称。
  • 非常感谢。你已经通过不同的网站给了我很大的帮助!
猜你喜欢
  • 1970-01-01
  • 2022-09-24
  • 2022-01-03
  • 1970-01-01
  • 2016-12-24
  • 2015-08-10
  • 2015-06-07
  • 1970-01-01
  • 2018-07-24
相关资源
最近更新 更多