Un ejemplo de uso de CDONTS que incluye validación de campos. A ver si te sirve.
<%
' Author: Joaquim Ferreira
' Example of how to call the function:
' Call EmailCdonts("
[email protected]",Recipient, "", "Subject",strBody ,0,"",2)
Function EmailCdonts(byval strAuthorEmail,byval strRecipientEmail,ByVal strCC, byval strSubject,byval strBody,
ByVal intMailFormat,ByVal strAttachmentPath,ByVal intPriority)
Dim ObjMail
'-----------------------[ START ERROR CHECKING ]---------------------------
If strAuthorEmail = "" or isnull(strAuthorEmail) Then
Response.Write("The author email parameter is missing")
Response.End
End If
If strRecipientEmail = "" or isnull(strRecipientEmail) Then
Response.Write("The Recipients email parameter is missing")
Response.End
End If
If strSubject = "" or isnull(strSubject) Then
Response.Write("The Subject parameter is missing")
Response.End
End If
If intMailFormat = "" or isnull(intMailFormat) Then
Response.Write("The Email Type parameter is missing, [ 0 = HTML / 1 - Text ] - Required Paramter")
Response.End
End If
'-----------------------[ END ERROR CHECKING ]---------------------------
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
ObjMail.FROM = strAuthorEmail
ObjMail.TO = strRecipientEmail
If strCC <> "" Then
ObjMail.Cc = strCC
End If
ObjMail.Subject = strSubject
ObjMail.BodyFormat = intMailFormat
ObjMail.MailFormat = intMailFormat
ObjMail.Body = strBody
' CdoHigh = 2 - Highest priority (Urgent)
' CdoNormal = 1 - Normal
' CdoLow = 0 - Lowest
ObjMail.Importance = intPriority
If strAttachmentPath <> "" Then
ObjMail.AttachFile strAttachmentPath
End If
ObjMail.Send
Set ObjMail= Nothing
End Function
%>