Flicks FAQ: Smattach


Back to the top of the FAQ

SMAttach

The SMAttach method attempts to send an electronic mail message with attachment(s).

Syntax

SMAttach(mailserver, recipient, sender, subject, message_text, attachment)

Parameters

mailserver
Specifies the name of SMTP mail server.
recipient
The email address of the person who will receive the electronic mail message. Multiple recipients separated by a comma only. You may need to surround the recipient name with angle brackets.
sender
The email address of the person sending the email message.
subject
The subject of the message.
message_text
The text of the message.
attach
The file to be attached. Multiple attachments separated by a comma only.

Return Values

Returns an empty string if the message was sent successfully. Otherwise returns a string indicating the error that occurred.

Notes

If you are sending a long message and you want to format the lines, use VbCrLf (Chr(13)+Chr(10) ) to insert end-of-lines. Eg

message = "Thanks,  " & vbCrLf & vbCrLf & "it works a treat!"
You cannot send an attachment from a client machine. You can only send attachment files that are located on the server. To be able to send client attachments using ASP from a client browser would be a gross breach of security.

Example

The following sends an email


<% Set ASPMail = Server.CreateObject("ASPMail.ASPMailCtrl.1") %>
<%
recipient = "Joe@mailer.net"
recipient = "Joe@mailer.net"
sender = "Cheryl@mailer.net"
subject = "Great Program"
message = "Thanks,  its a snap to use!"
mailserver = "mailer.flicks.com"
attach = "f:\zip\addurl.zip"
attach = attach & ","
attach = attach & "c:\sounds\thisIsGreatMan.wav"

result = ASPMail.SMAttach(mailserver, recipient, sender, subject, message, attach)
%>
<% If  "" = result Then %>
<P>
Mail has been sent.
<P>
<% Else %>
<P>
Mail was not sent, error message is
<H2>
<%= result %>
</H2>
<P>
<% End If %>


 

Applies To

OCXMail ASP Component

http://www.flicks.com/authentix/discover/main.htm

Back to the top of the FAQ