ciao a tutti sto cercando un metodo che mi permetta di inviare un file su un server e rinominarlo solo per l'email
codice:
Function AttachFile(roMsg, rsFilePath, rsNewName)
roMsg.AddAttachment rsFilePath
With roMsg.Attachments(1).Fields
.Item(cdoContentDisposition) = "attachment;filename=" & rsNewName
.Update
End With
End Function
Dim ObjSendMail
Set ObjSendMail = Server.CreateObject("CDO.Message")
'Set ObjSendMail = CreateObject("CDO.Message")
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/configuration/smtpserver") ="xxxxxxx"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="xxxxx"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="xxxxxx"
ObjSendMail.Configuration.Fields.Update
nomefile= "Attestati_Scheda_QGLRRT78C44L219L_0_6_10_8_2011"
ObjSendMail.To = email
AttachFile ObjSendMail, Server.MapPath("allegati/dazipp/" & nomefile & ".zip"), "Scheda presenza.zip"
mi restituisce il seguente errore.
ADODB.Fields error '800a0bb9'
Gli argomenti non sono di tipo valido, non sono compresi nell'intervallo consentito o sono in conflitto.
/site/Corsi/testsmtpOKroby.asp, line 9
la riga 9 è quella segnata in rosso