Q:

Giving an attachment a name when sending it with VBscript

set cdoConfig = CreateObject("CDO.Configuration")
with cdoConfig.Fields
  .Item(cdoSendUsingMethod) = cdoSendUsingPort
  .Item(cdoSMTPServer) = "localhost"
  .Item(cdoSMTPAuthenticate) = 1
  .Item(cdoSendUsername) = "contact@example.com"
  .Item(cdoSendPassword) = "password"
  .Update
end with
set cdoMessage = CreateObject("CDO.Message")
with cdomessage
set .Configuration = cdoConfig
  .From = "contact@example.com"
  .To = email
  .Subject = subject
  .HTMLBody = message
  .AddAttachment "c:/i/report.pdf"
  .Send
end with
set cdomessage = nothing
set cdoconfig = nothing

Everything sends find, but the recipient gets the message as "Untitled Attachment 000X.pdf"
How do I give the attachment a name?

A:

I have something like this. But never tried.
'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

