Codefixer - ASP tutorials, resources and software
ASP.NET 3.5/2.0 Hosting – Click Here
Home   Articles   Resources   ASP directory   ASP Tutorials   Code Snippets   ASP Applications   Forum
Friday 9 May
MembersPro PayPal - ASP Membership software

DiscountASP.NET – ASP.NET 3.5/2.0 Hosting


ASP Partner ASP Partner ASP Partner more partners...

Send an Email Attachment Using CDOSYS in ASP

<%
Option Explicit
'Declare variables
Dim sch, cdoConfig, cdoMessage
sch = "http://schemas.microsoft.com/cdo/configuration/"
 
    Set cdoConfig = CreateObject("CDO.Configuration")
 
    With cdoConfig.Fields
        'Set CDO Port
        .Item(sch & "sendusing") = 2
        'Set mailserver name either IP address, mail.yoursite.com or localhost
        .Item(sch & "smtpserver") = "127.0.0.1"
        'Set SMTP port which is 25 by default
        .Item(sch & "smtpserverport") = 25
        'Set number of seconds before timeout
        .Item(sch & "smtpconnectiontimeout") = 60
        .update
    End With
 
    Set cdoMessage = CreateObject("CDO.Message")
 
    With cdoMessage
        Set .Configuration = cdoConfig
        .From = "youremail@yoursite.com"
        .To = "recipient@theirsite.com"
        .Subject = "Test Email"
        .HTMLBody = "This is a test email."
        .AddAttachment "c:\images\myimage.jpg"
        .Send
    End With
 
    Set cdoMessage = Nothing
    Set cdoConfig = Nothing
%>





If you have any code snippets to share with full credit given then send an email to Codesnippets - You'll receive full credit and a link back to your site.

ASP.NET 3.5/2.0 Web Hosting: 3 Months FREE – Click Here!




About | Contact | Advertise | Feedback | Hire Us | Link

Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.

Do you intend to move to ASP.NET or have you already?
Yes will do
Have done
ASP does fine
Not a priority


Directory Software