2015-01-14 48 views
0
set cdoConfig = CreateObject("CDO.Configuration") 
with cdoConfig.Fields 
    .Item(cdoSendUsingMethod) = cdoSendUsingPort 
    .Item(cdoSMTPServer) = "localhost" 
    .Item(cdoSMTPAuthenticate) = 1 
    .Item(cdoSendUsername) = "[email protected]" 
    .Item(cdoSendPassword) = "password" 
    .Update 
end with 
set cdoMessage = CreateObject("CDO.Message") 
with cdomessage 
set .Configuration = cdoConfig 
    .From = "[email protected]" 
    .To = email 
    .Subject = subject 
    .HTMLBody = message 
    .AddAttachment "c:/i/report.pdf" 
    .Send 
end with 
set cdomessage = nothing 
set cdoconfig = nothing 

一切都將發現它發送的時候,但收件人收到消息爲「未命名附件000X.pdf」使用VBScript

如何給附件的名稱給人一種附件的名稱?

回答

1

我有這樣的事情。但從未嘗試過。

'With cdomessage 

.AddAttachment "c:/i/report.pdf" 
.Attachments(1).Fields.Item("urn:schemas:mailheader:content-disposition") ="attachment;filename=" & NEWNAME 
.Attachments(1).Fields.Update 

'End With 
+0

@kricket,它有幫助嗎?只是好奇。 – vins

+0

工作完美,我可以問問你在哪裏找到這些信息? – kqlambert

+0

@kricket,我已經創建了這個(通過引用MSDN中的CDO對象模型)long back(4年前)爲項目自動發送狀態電子郵件。但我們沒有機會發送任何附件。 – vins