我正在尝试编写一个简短的程序,它将读取我的Exchange/Outlook配置文件中的文件夹中的电子邮件内容,以便我可以操作数据.但是我在查找有关python和Exchange/Outlook集成的大量信息时遇到了问题.很多东西要么很老/没有文档/没有解释.我尝试了几个片段,但似乎得到了同样的错误.我试过Tim Golden的代码:
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 ("Outlook")
messages = session.Inbox.Messages
#
# Although the inbox_messages collection can be accessed
# via getitem-style calls (inbox_messages[1] etc.) this
# is the recommended approach from Microsoft since the
# Inbox can mutate while you're iterating.
# …Run Code Online (Sandbox Code Playgroud) 我尝试通过本地服务器发送时收到此错误
CDO.Message.1 error '80070005'
Access is denied.
/mail.asp, line xxx
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的代码
MailBodyText = "TEST"
Set objNewMail = CreateObject("CDO.Message")
objNewMail.To = sSendTo
objNewMail.From = "webmaster@EXAMPLE.com"
objNewMail.Cc = "webmaster@EXAMPLE.com"
objNewMail.Subject = "Information Request & Feedback"
objNewMail.HTMLBody = "The following information was sent from " & sEmail & ":" & "<br>" & CHR(13) & MailBodyText & "<br>copies of this mail we sent to :"& sSendTo
objNewMail.Send
Set objNewMail = Nothing
Run Code Online (Sandbox Code Playgroud)
看起来它是ISSUR上的权限错误,没有写入mailroot/pickup文件夹的写入权限.
但我们已经检查过,该网站正在使用的服务帐户似乎拥有这些权利.
问题是这个错误总是文件权限错误?
问如何知道/设置CDO使用的位置?所以我们可以确认权限
还有什么可以解决这个问题?
以下字符串的格式是针对Microsoft Exchange调用的?
/o=First Organization/ou=First Administrative Group/cn=Recipients/cn=user
Run Code Online (Sandbox Code Playgroud)
我已经看到这个使用LDAP,但现在看到它CDO 1.2.1并最终尝试将其转换为电子邮件地址,如user@domain.com.谢谢.
我尝试在这个对象上设置一些属性来发送一个具有高重要性的电子邮件,但似乎没有任何效果.这是我尝试过的:
objEmail.Importance = 2
objEmail.Configuration.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High" ' For Outlook 2003
objEmail.Configuration.Fields.Item("urn:schemas:mailheader:X-Priority") = 2 ' For Outlook 2003 also
objEmail.Configuration.Fields.Item("urn:schemas:httpmail:importance") = 2
Function Send(sTo As String, sFrom As String, sSubject As String)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = sFrom
objEmail.To = sTo
objEmail.Subject = sSubject
objEmail.Textbody = emailBody
objEmail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "my.smtp.server"
objEmail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
// is there a property for high importance, outlook 2007?
objEmail.Configuration.Fields.Update
objEmail.Send
End Function
Run Code Online (Sandbox Code Playgroud) 是否有一些技巧使VBScript CDO与Amazon SES SMTP协同工作?我没有收到任何错误,但它也没有发送给我我的测试电子邮件.将SSL更改为False确实给我530错误,所以我知道我至少到达了服务器.我究竟做错了什么?
EmailSubject = "Sending Email by CDO"
EmailBody = "This is the body of a message sent via" & vbCRLF & _
"a CDO.Message object using SMTP authentication."
Const EmailFrom = "yyy@xxx.com"
Const EmailFromName = "Me Test"
Const EmailTo = "eee@aaa.com"
Const SMTPServer = "email-smtp.us-east-1.amazonaws.com"
Const SMTPLogon = "xxxxxx"
Const SMTPPassword = "xxxxxxx"
Const SMTPSSL = True
Const SMTPPort = 25
Const cdoSendUsingPickup = 1 'Send message using local SMTP service pickup directory.
Const cdoSendUsingPort = 2 …Run Code Online (Sandbox Code Playgroud) 我在使用HTMLBody格式的ASP Classic中使用CDOSYS邮件系统发送电子邮件时遇到问题。它似乎有一个字符限制,并且在发送电子邮件时,它将在电子邮件底部附近切断该消息。起初,我以为是在写完所有电子邮件之前就已发送了该消息,但是在经过一些故障排除和研究之后,使用HTMLBody时存在某种CDOSys消息字符限制。我的问题是,是否有任何方法可以覆盖字符数限制或绕开限制?这仅适用于HTMLBODY。
编辑:“重复”标志不会帮助我。这不是截断问题,而是具有HTMLBody限制的问题,该问题阻止了冗长的消息在消息中被完全发送。我检查了那篇文章,这不是我在寻找答案。在此主题上的答复足以回答我的问题。谢谢你们。
这是我的代码:
Set myMail=CreateObject("CDO.Message")
HTML = HTML & "<html>"
HTML = HTML & "<body>"
HTML = HTML & "<font face='calibri'>"
HTML = HTML & "<img src='http://" & SupportTagURLWebPath & "/images/SkypeEmailHeader.png'>"
HTML = HTML & "<br><Br>"
HTML = HTML & "<font face='calibri'>"
HTML = HTML & "<b>To " & Request.Form("SkypeTemplateName") & ":</b>"
HTML = HTML & "<br><br>"
HTML = HTML & "Thank you for contacting the Bank of America Service Desk. We're committed to providing seamless support in the …Run Code Online (Sandbox Code Playgroud) 我在 excel 中写了一个宏,我通过 Gmail 发送邮件。我正在发送邮件,但无法发送图片,因为我无法在 Gmail 邮件正文中粘贴图片。我把我的代码。我也从activesheet(根据我的excel的Sheet4)获取图片。如何在我的邮件正文中添加这张图片?
Sub SendGmail(frommail As String, password As String, tomail As String, subject As String, mesaj As String)
Dim pic As String
pic = CheckImageName
If pic <> "" Then
Sheet4.Shapes(pic).Copy
End If
If frommail <> "" And password <> "" And tomail <> "" And subject <> "" And mesaj <> "" Then
On Error Resume Next
'creating a CDO object
Dim Mail As CDO.message
Set Mail = New CDO.message
'Enable SSL Authentication
Mail.Configuration.Fields.Item …Run Code Online (Sandbox Code Playgroud) 我正在使用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.Text
session.Logoff()
Run Code Online (Sandbox Code Playgroud)
但是,附件名称类似于:"zesjvqeqcb_chart_0".在电子邮件源中,我看到如下图像源链接:<IMG src ="cid:zesjvqeqcb_chart_0">
那么,是否可以使用此CID URL(或其他任何内容)来提取实际图像并将其保存在本地?
发送电子邮件时出错:"错误'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/configuration/smtpserver") = "smtp.office365.com" 'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "someone4@s.com" 'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "******" 'Your password on the SMTP server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'Server port (typically 25)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true …Run Code Online (Sandbox Code Playgroud) 在端口 587(使用 TLS 安全协议的端口)上使用 CDO 发送邮件有什么技巧吗?
\n这是我的 C++ 代码:
\nCDO::IMessagePtr iMsg(__uuidof(CDO::Message));\nCDO::IConfigurationPtr iConf = iMsg->GetConfiguration();\nCDO::FieldsPtr iFields;\n_bstr_t empty("");\niConf->Load(CDO::cdoIIS,empty); // this string constant from import\niFields = iConf->Fields;\n\niFields->Item["https://schemas.microsoft.com/cdo/configuration/smtpserver"]->Value = _variant_t(szServer);\niFields->Item["https://schemas.microsoft.com/cdo/configuration/smtpserverport"]->Value = _variant_t(587);\niFields->Item["https//schemas.microsoft.com/cdo/configuration/sendusing"]->Value = 2;\niFields->Item["https//schemas.microsoft.com/cdo/configuration/smtpauthenticate"]->Value = _variant_t(1); // Basic\niFields->Item["https//schemas.microsoft.com/cdo/configuration/sendusername"]->Value = _variant_t(szUser);\niFields->Item["https//schemas.microsoft.com/cdo/configuration/sendpassword"]->Value = _variant_t(szPassword);\n\nif(iUseSSLTLS == 2)\n iFields->Item["https//schemas.microsoft.com/cdo/configuration/sendtls"]->Value = _variant_t(true);\nelse\n iFields->Item["https//schemas.microsoft.com/cdo/configuration/smtpusessl"]->Value = _variant_t(true);\n\niFields->Update();\netc... etc...\nRun Code Online (Sandbox Code Playgroud)\n如果我将此代码与以下内容一起使用smtp.gmail.com:
我得到以下回复:
\ncdo.message ×10
email ×5
asp-classic ×2
outlook ×2
python ×2
vba ×2
vbscript ×2
amazon-ses ×1
c++ ×1
excel ×1
iis-7 ×1
ldap ×1
mapi ×1
smtp ×1
vb.net ×1