Home · Standard Web Hosting · Dedicated Web Hosting · Managed Name Servers · E-Mail Services
 
Home
/ Browse Categories / SmartWeb / Windows Services / Sample Code for Components
Sample Code for Components
Please refer to the following code examples when using these components:

ASPMail

<%
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = Request.Form("yourname")
Mailer.FromAddress = Request.Form("youraddress")
Mailer.RemoteHost = "mail.domain_name.com"
Mailer.AddRecipient Request.Form("toname"), Request.Form("toaddress")
Mailer.AddCC Request.Form("ccname"), Request.Form("ccaddress")
Mailer.Subject = Request.Form("subject")
message = "Message: " & Request.Form("message")
message = message & vbCRLF
Mailer.BodyText = message
if Mailer.SendMail then
%>

ASPUpload

<%
'Authorize User
' Uplolad Script
Dim members_path
path = Server.MapPath("/")
Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.Save path
For Each File in Upload.Files
   If File.ImageType <> "GIF" and File.ImageType <> "JPG" Then
      Response.Write "GIF or JPG files only please!<BR>"
   End If
   If File.ImageWidth > 150 OR File.ImageHeight > 150 Then
      Response.Write "Image cannot exceed 150 pixels squared.<BR>"
   End IF
   If File.Size > 500000 then
      Response.Write("Too Much!<BR>")
   End If
   Response.Write File.Path & " (" & File.Size &")<BR>"
Next
%>

CDONTS

If you send email using CDONTS, it does not allow you to determine if the email was sent correctly or even if the email address exists. We highly recommend using JMail or ASPMail instead. Both of these components wait until the mail has been delivered before returning control to the ASP page, and they provide error handling for failures.

Set objMail=Server.createobject("CDONTS.NewMail")
objMail.From=strEmail
objMail.To="username@domain.com"
objMail.Subject=strSubject
objMail.Body=strDetails & vbcrlf & vbcrlf & strCompany & vbcrlf & strFirstName & " " & strLastName
objMail.send

SA FileUp

<% Set upl = Server.CreateObject("SoftArtisans.FileUp")
upl.Path = Server.Mappath ("/directory_name")
upl.SaveAs "upload.tst"%>



User Comments
Sample Code for Components
Add Comment
There are no user comments for this topic.
Add Comment
Additional Info
General Information
Article No. 77
Created: 01:48 AM 04.16.04
Author: Support

Attachments
No attachments.

Did this help you?
Yes No

Statistics
Yes492 (41%) Voted Yes709 (59%) Voted NoNo

Other Options
Print Article
Email Article

Related Articles
What COM Objects / Components do you support?
Create a DSN for an MS Access Database
Create a DSN for a MS SQL server
Create a DSN for a MySQL Database
Connecting to a database with a DSN

Copyright © 2013 myonlinehostingsupport.com