|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Cdont Excel Attachment
I use cdont for sending automatically my mails, but now i want to send a excel attachment but the reciever can't get it open. He has send it back to me and he is wright, it isn't any more a excel file. Does somebody now a solution?
Code:
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="mizn.xls"
myMail.From="***"
myMail.To="***"
myMail.AddAttachment ("C:\Inetpub\vhosts\***/mizn.xls")
myMail.Configuration.Fields.Item _
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
'Server port
myMail.Configuration.Fields.Item _
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>
Last edited by jmurrayhead : February 8th, 2008 at 05:23 AM. |
|
#2
|
||||
|
||||
|
Cdont Excel Attachment
firstly this code isn't CDONT it's CDOSYS.
personally i wouldn't use a file path, i would create a virtual directory away from the Inetpub folder and place the report files in there and then map the path accordingly. try using the code example below and edit as ness: Code:
Set objCDOMail = CreateObject("CDO.Message")
Set objConfig = CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
sch = "http://schemas.microsoft.com/cdo/configuration/"
strAttachment = "[FULL FILE PATH]"
With Fields
.Item(sch & "sendusing") = 2
.Item(sch & "smtpserver") = "[IP_ADDRESS or DNS_NAME]"
.Item(sch & "smtpserverport") = 25
.Item(sch & "smtpconnectiontimeout") = 30
.Item(sch & "sendusername") = "username"
.Item(sch & "sendpassword") = "password"
.Update
End With
With objCDOMail
Set .Configuration = objConfig
.From = "me@mydomain.com"
.To = "you@yourdomain.com"
.Subject = "your Report"
.TextBody = "Please find attached the requested report."
.addAttachment strAttachment
.Send
End With
Set objCDOMail = Nothing
Set Fields = Nothing
Set objConfig = Nothing
__________________
Hope this advise helps. ![]() If so please show your appreciation by adding reputation points (clcik gauge image on top right of this post).
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Cdont Excel Attachment |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|