无法使用VBA发送电子邮件 [英] Cant send email using VBA

查看:290
本文介绍了无法使用VBA发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个自动发送电子邮件的工具。

I am creating a tool that will automatically dispatch emails out.

我已经开始使用以下非常简单的代码来构建它:

I have started to build it using very simple code as below:

Set outlookobj = New Outlook.Application
Set mitem = outlookobj.CreateItem(olMailItem)

With mitem
.To = "A_Valid_Email@email.com"
.Subject = "TEST"
.Body = "test"
.Display
.Send

End With
End Sub

但是我工作的公司似乎已经倒闭了。发送。电子邮件会很好,但不会发送。谁能想到解决这个问题的方法?我已经考虑过使用.sendkeys ^ {ENTER}了,但是我知道它们不是做事的好方法。

However the company I work for seem to have locked down .send. The email will create fine but will not send. Can anyone think of a way around this? I have considered using .sendkeys "^{ENTER}" however I know they are not a good way to doing things.

在此先感谢您
Matt

Thank you in advance Matt

推荐答案

我指的是此线程:使用Outlook的Excel VBA发送邮件-发送方法失败,解决方法如下:

I'm referring to this thread: Excel VBA sending mail using Outlook - Send method fails where the solution was the following:

更改。发送到.Display并将SendKeys ^ {ENTER}放在With mitem行之前。

"Change .Send to .Display and put SendKeys "^{ENTER}" before the With mitem line."

您至少可以尝试一下,也许它也为您服务。 :)

You can at least try it, maybe it works for you as well. :)

这篇关于无法使用VBA发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆