ASP Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

ASP Examples

ASP String
ASP Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar
ASP Upload
XML
XMP
Zip Compression

More Examples...
Email Object
DKIM / DomainKey
NTLM
DH Key Exchange
DSA
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

Load MIME (or S/MIME) and Send as Email

Demonstrates how to load a MIME file and send it as email.

Download Chilkat Email ActiveX

Download Chilkat IMAP ActiveX

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set mime = Server.CreateObject("Chilkat.Mime")
set mailman = Server.CreateObject("Chilkat.MailMan2")

'  Any string argument automatically begins the 30-day trial.
success = mime.UnlockComponent("30-day trial")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(mime.LastErrorText) & "</pre>"

End If

'  Any string argument automatically begins the 30-day trial.
success = mailman.UnlockComponent("30-day trial")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(mailman.LastErrorText) & "</pre>"

End If

'  Set the SMTP server.
mailman.SmtpHost = "smtp.chilkatsoft.com"

'  Set the SMTP login/password (if required)
mailman.SmtpUsername = "myUsername"
mailman.SmtpPassword = "myPassword"

'  Load the MIME (or S/MIME) from a file:
success = mime.LoadMimeFile("edifact_smime.txt")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(mime.LastErrorText) & "</pre>"

End If

fromAddr = "admin@chilkatsoft.com"
recipient = "support@chilkatsoft.com"

'  Add email header fields to the MIME:
mime.AddHeaderField "From",fromAddr
mime.AddHeaderField "To",recipient
mime.AddHeaderField "Subject","Here is my EDIFACT signed and encrypted..."

'  We want a Date header with the current date/time.  The email object
'  automatically generates it.  Therefore we'll create an email object and then
'  copy the Date header:
set email = Server.CreateObject("Chilkat.Email2")
dateStr = email.GetHeaderField("Date")
mime.AddHeaderField "Date",dateStr

'  It is not necessary to save the MIME to a file.
'  We're doing it here just to have a look at the .eml in a text editor...
success = mime.SaveMime("email.eml")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(mime.LastErrorText) & "</pre>"

End If

'  Now send the MIME via SMTP:
mimeContent = mime.GetMime()
success = mailman.SendMime(fromAddr,recipient,mimeContent)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(mailman.LastErrorText) & "</pre>"

End If

success = mailman.CloseSmtpConnection()
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode("Connection to SMTP server not closed cleanly.") & "</pre>"
End If

Response.Write "<pre>" & Server.HTMLEncode("Mail Sent!") & "</pre>"
%>
</body>
</html>

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.