我想编写一个脚本,该脚本通过我们的公司SMTP服务器发送电子邮件. 首先,我试图为此目的编写HTA应用程序,但是使它变得足够舒适变得很麻烦,以便其他人可以很好地处理它(由于适当的接收者解决). 因此,现在我尝试使用常规的Outlook邮件蒙版首先准备邮件,然后通过VBScript捕获Send-Item事件,以将其内容提供给我的CDO脚本. 现在,我的代码看起来像这样: Dim OutlookApplication Dim MailItem Const olDiscard = 1 Const olMailItem = 0 Set OutlookApplication = WScript.CreateObject("Outlook.Application", "Outlook_") Set MailItem = OutlookApplication.CreateItem(olMailItem) MailItem.Display '(...) some code t
以下是关于 cdo.message 的编程技术问答
我有一个处理工作请求的Web应用程序.它通过电子邮件向涉及的新,更改和完成的请求发送电子邮件.问题是,当它发送电子邮件时,该页面需要加载一段时间.没有电子邮件过程,它可以正常工作.我正在使用CDO直接从代码范围内发送消息.有没有更好的方法不会绑定网页? 更改请求后,我考虑过可能独立运行EXE.有没有一种方法可以将脚本进行处理,可以处理电子邮件,但是继续使用网页加载,因此被壳脚本从页面的代码中独立运行? 独立运行? 解决方案 您可以考虑在数据库表中排队电子邮件或专用服务读取的文本文件. 将电子邮件写到数据库或文本文件将很快,服务只需要检查一次更改. 问题是,您无法通知用户电子邮件未发送,尽管您将遇到同样的问题,试图执行另一个程序.
我正在使用Microsoft的CDO(协作数据对象)来从Outlook邮箱中读取邮件并保存嵌入式图像附件.我正在尝试使用win32扩展名来从Python中执行此操作,但是任何使用CDO语言的样本都会有所帮助. 到目前为止,我在这里... 以下Python代码将读取我的邮箱中的最后一封电子邮件,打印附件的名称,然后打印消息正文: from win32com.client import Dispatch session = Dispatch('MAPI.session') session.Logon('','',0,1,0,0,'exchange.foo.com\nbar'); inbox = session.Inbox message = inbox.Messages.Item(inbox.Messages.Count) for attachment in message.Attachments: print attachment print message
我有Office 2003 VBA代码,该代码使用此处描述的技术使用无证件的MAPI属性和CDO 1.21的HTML消息中的图像. cdo 1.21不再得到支持,而是 >现在,它的大部分功能已纳入Outlook 2010对象模型. 在哪里可以找到使用Outlook 2010对象模型在Outlook 2010中嵌入图像的示例? 解决方案 找到答案在这里.. 关键位是: Const PR_ATTACH_MIME_TAG = "http://schemas.microsoft.com/mapi/proptag/0x370E001E" Const PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001E" Const PR_ATTACHMENT_HIDDEN = "http://schemas.microsoft.com/mapi/pro
我正在尝试编写一个简短的程序,该程序将在我的Exchange/Outlook配置文件上的文件夹中的电子邮件中读取,以便我可以操纵数据.但是,我遇到了一个问题,可以找到有关Python和Exchange/Outlook集成的很多信息.很多东西要么很旧,要么没有文档/未解释.我尝试了几个片段,但似乎遇到了相同的错误.我尝试了蒂姆·戈登的代码: import win32com.client session = win32com.client.gencache.EnsureDispatch ("MAPI.Session") # # Leave blank to be prompted for a session, or use # your own profile name if not "Outlook". It is also # possible to pull the default profile from the registry. # session.Logon ("Ou
我有以下代码使用CDO从VBA宏发送邮件.我在代码中遇到错误: 运输无法连接到服务器错误 我正在发送Gmail SMTP服务的邮件.看起来配置正确设置了,但某种程度上不起作用. Sub Email() Dim CDO_Mail As Object Dim CDO_Config As Object Dim SMTP_Config As Variant Dim strSubject As String Dim strFrom As String Dim strTo As String Dim strCc As String Dim strBcc As String Dim strBody As String strSubject = "Results from Excel Spreadsheet" strFrom = "xxx@gmail.com" strTo = "xxx@
我正在使用CDO.SYS遇到一个奇怪的问题,用于从启用VBA的Excel应用程序中发送电子邮件. 我已经使用了以下代码,可以在 https://wwww.rondebruin.nl/win/s1/cdo.htm : Sub SendMailCDO(FSubject As String, FBody As String, FFrom As String, FTo As String, FCc As String) Dim iMsg As Object Dim iConf As Object Dim Flds As Variant Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") iConf.Load -1 ' CDO Source Defaults Set Flds = iConf.Fields
我的以下代码在PC上正常工作,但在Mac上不起作用.我希望该脚本能够识别当前的操作系统并运行该操作系统的适当命令集. 宏创建带有工作簿附件的电子邮件.附件是ActiveWorkbook的临时版本,在发送电子邮件后将删除. 我目前正在使用电子邮件的方法是Windows CDO.当它在Mac OSX上执行使用Office 2016时,我还应该注意其他考虑吗? Private Message As CDO.Message Private Attachment, Expression, Matches, FilenameMatch, i Sub enviar_mail() Dim wb1 As Workbook Dim TempFilePath As String Dim TempFileName As String Dim FileExtStr As String With Application .Screen
我已经有以下代码,并且我正在尝试设置从字段设置以允许Unicode.目前在我的电子邮件客户端中我得到了"?". 主题行和任何内容都正确显示了Unicode.查看MSDN,该属性应为"urn:schemas:httpmail:from". 有人解决了这个问题吗? Dim AC_EMAIL : AC_EMAIL = "test@test.com" Dim AC_EMAIL_FROM : AC_EMAIL_FROM = "测试 " Dim strSubject : strSubject = """测试"" testing testing" set oMessage = WScript.CreateObject("CDO.Message") With oMessage .BodyPart.charset = "utf-8" 'unicode-1-1-utf-8 .Fields("urn:schemas:httpmail:from
是否有人能够下载包含CDO附件的电子邮件? 你能帮我一个例子吗? 解决方案 我仍然不确定您要从哪里检索电子邮件,但这里有一些用于从Exchange Server检索电子邮件的代码.我这样做是作为一个实验来学习我在另一个项目上需要的一些方法,因此它不是生产质量,而应该让您开始. 此代码取决于已经在运行的计算机上设置的Exchange客户端. 此功能创建一个会话并登录: Function Util_CreateSessionAndLogon(Optional LogOnName As Variant) As Boolean On Error GoTo err_CreateSessionAndLogon Set objSession = CreateObject("MAPI.Session") objSession.Logon , , False, False Util_CreateSessionAndLogon = True
我正在使用ASP Classic和CDO将电子邮件发送到CreateMHTMLBody方法.我在我的电子邮件中有几个图像,其中一些是静态的,不会改变,但其中一些将根据电子邮件内容进行更改.即使我拥有完整路径URL地址,ICLoud会将图片显示为附件.我已经使用了AddRelatedBodyPart但是现在他们在那个地方显示了你必须是但仍然显示附件中的图像的地方.我想要图片只是在没有附件的电子邮件正文中展示.有谁知道如何解决这一问题?这是我的代码: 的示例 Set myMail=CreateObject("CDO.Message") myMail.Subject= "Subject of Email" myMail.From= "from@site.com" myMail.To= "to@site.com" myMail.CreateMHTMLBody "http://www.mysite.com/email.html" strImagePath = Server.MapPath("
我有一些asp代码,我从我的前任那里"继承了"(不,这不是一个选择它的选项,这次是更新它......它将采取行为不仅是国会,而是其他外国也是如此)我正在发行一个页面上的一个问题.它是一个几乎相同的代码片段,但是当我尝试'发送'时,这一点抛出了错误. 代码下面: Set myMail=CreateObject("CDO.Message") myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 'Name or IP of remote SMTP server myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="localhost" 'Server port myMail.Configuration.Fie
我们在经典ASP中使用CDO对象在电子邮件正文中获取随机感知(!)标记. 我们没有通过Outlook获得这种感叹号.问题仅在Lotus Notes客户端出现.我们使用IIS SMTP服务器发送电子邮件. 编辑 Set myMail= Server.CreateObject("CDO.Message") myMail.Subject="Business and Company News on your Mobile Device" myMail.From="no-reply@test.com" myMail.To="some@email.com" htmlbody = htmlbody (coming runtime) myMail.BodyPart.ContentTransferEncoding = "quoted-printable" myMail.HTMLBody = htmlbody myMail.Send 我认为客户端不使用smtp.但他们肯定正在使用Lot
我正在尝试通过VBScript发送电子邮件.这是我的电子邮件代码: 我当然隐藏了电子邮件地址.在我的实际代码中,我正在使用有效的电子邮件地址. Dim objCDO Set objCDO = Server.CreateObject("CDO.Message") objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.oa.caiso.com" objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objCDO.Conf
我正在尝试使用Google Apps帐户作为SMTP服务器从传统经典ASP脚本发送联系人查询电子邮件.我必须测试的代码如下: Dim ObjSendMail Set ObjSendMail = CreateObject("CDO.Message") 'This section provides the configuration information for the remote SMTP server. ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network). ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/co
我想使用CDA在VBA中访问Gmail帐户中的收件箱. 我已经设法发送了一条邮件,但不知道如何将收件箱消息获取到Excel表中. 如果可能的话,我也希望能够识别每个消息的标签. 解决方案 虽然问题尤其要求CDO,但从这种类似的问题 CDO看起来直接可能是可以的. 作为获取收件箱邮件邮件的替代方法,Google最近发布了可以用Excel消费的Gmail API.以下是一个示例,使用' Setup client and authenticator (cached between requests) Private pGmailClient As WebClient Private Property Get GmailClient() As WebClient If pGmailClient Is Nothing Then ' Create client with base url that is appended to all requests Set pGmailClient
我正在尝试使用Exchange帐户设置脚本来发送电子邮件.我想将CDO(或等效)与VBScript一起使用.目标是通过Exchange帐户的发送文件夹跟踪电子邮件通信. 我正在使用Exchange2007. 解决方案 使用Microsoft ntlm( httpp ://msdn.microsoft.com/en-us/library/aa378749(v = vs.85).aspx ) 在CDO中,这是一个CDOProtocolSauthentication枚举( http://http://http://msdn.microsoft.com/en-us/library/ms526961(V=EXCHG.10).aspx ) Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory. Const cdoSendUsingPort = 2 'Send t
我正在尝试使用Microsoft Office Excel 2007 VBA代码发送邮件,但我遇到了错误: 运行时错误'-2147220973(80040213)': 自动化错误 我正在使用的代码是: Dim cdomsg As Object Set cdomsg = CreateObject("CDO.message") With cdomsg.Configuration.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 25 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
发送电子邮件时有错误: "错误'80040211'" 这是我的代码的示例 - Dim objMessage Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "Super Service Comment - " objMessage.From = "someone@s.com" objMessage.To = "someone1@s.zendesk.com;someone2@s.com" objMessage.TextBody = "Name...." objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/