Hi all,
i am using AB Mailer (so this may not be place to write this is!?) to senf automated email messages to subscribers.
the problem is the meails are getting sent fine bu the message body is not appearing. Now if i sent it to something like hotmail then it puts the body as an attachement. to other email programs there is just no body at all?
Code:
<%LANGUAGE=VBScript%>
<%
'-- Global Variables
Dim sFrom ' email address of sender
Dim sTo ' email address of primary recipient(s)
Dim sCc ' email address(es) of CC recipient(s)
Dim sBcc ' email address(es) od blind CC recipients
Dim sSubject ' email subject line
Dim sMessage ' email message-text body
Dim sPriority ' priority of message
Dim sMT ' message type (text or HTML)
Dim sBadDataField ' field containing bad data
'---- Mailman Error Constants ----
Const mmeNone = 0 ' Mail delivered successfully to SMTP server
Const mmeUndefined = 1 ' Undefined (internal) error, out-of-memory, etc...
Const mmeWinsock = 2 ' Network, TCP/IP, or general socket error
Const mmeReplyTo = 3 ' Error in "ReplyTo" line. For version 2.0 no longer used (see mmeRecipient).
Const mmeSendTo = 4 ' Error in "SendTo" line. For version 2.0 no longer used (see mmeRecipient).
Const mmeSendCc = 5 ' Error in "SendCc" line. For version 2.0 no longer used (see mmeRecipient).
Const mmeServerAddr = 6 ' Error in "ServerAddr" line, Server not found, etc...
Const mmeServerPort = 7 ' Invalid Server Port ID (default SMTP is 25)
Const mmeAttachment = 8 ' Could not find one of the attachments. Refer to "ErrorMsg".
Const mmeAuthentication = 9 ' Error authenticating with SMTP server.
Const mmeRecipient = 10 ' Could not find one of the recipients. Refer to "ErrorMsg".
Const mmeEvaluationExpired = 11 ' Evaluation copy of ABMailer has expired. Please register your copy of ABMailer.
'---- Default Constants ----
Const mmdServerPort = 25 ' Default SMTP Server Port ID
'---- Mailman Error Code Strings ----
ReDim mmeMessage(11)
mmeMessage(0) = "Mail delivered successfully to SMTP server"
mmeMessage(1) = "Undefined (internal) error, out-of-memory, etc..."
mmeMessage(2) = "Network, TCP/IP, or general WinSock error"
mmeMessage(3) = "Error in 'ReplyTo' line. For version 2.0 no longer used (see mmeRecipient)."
mmeMessage(4) = "Error in 'SendTo' line. For version 2.0 no longer used (see mmeRecipient)."
mmeMessage(5) = "Error in 'SendCc' line. For version 2.0 no longer used (see mmeRecipient)."
mmeMessage(6) = "Error in 'ServerAddr' line, Server not found, etc..."
mmeMessage(7) = "Invalid Server Port ID (default SMTP is 25)"
mmeMessage(8) = "Could not find one of the attachments. Refer to 'ErrorMsg'."
mmeMessage(9) = "Error authenticating with SMTP server."
mmeMessage(10) = "Could not find one of the recipients. Refer to 'ErrorMsg'."
mmeMessage(11) = "Evaluation copy of ABMailer has expired. Please register your copy of ABMailer."
'-- Set a few default values
sPriority = 2
sMT = 0
sSubject = "Results from form on website"
'-- now get user defined details
%>
<!--#include file="./user.inc"-->
<%
'-- Define functions
'----SendTheMail()--------------------------------------------------------------------
Function SendTheMail()
'-- Allocate Variables
Dim objMail
'-- Set Error Trapping
On Error Resume Next
Err.Number = 0
'-- Create the Mailman Object
Set objMail = Server.CreateObject("ABMailer.Mailman"
'-- Set the Mail Properties
objMail.Clear
objMail.MailSubject = sSubject
objMail.FromAddress = sFrom
objMail.ReplyTo = sFrom
objMail.SendTo = sTo
objMail.SendCc = sCC
objMail.SendBcc = sBcc
objMail.ServerAddr = "mailhost.somwhere.co.uk"
objMail.ServerPort = "25"
objMail.MailMessage = sMessage
objMail.XPriority = sPriority
objMail.MessageType = 0
'-- Send email message
objMail.SendMail
'-- Set return value to error-code value (mmeNone = Success)
SendTheMail = objMail.ErrorCode
End Function
'----FillGlobalVars()------------------------------------------------------------
Function FillGlobalVars()
'-- Set Error Trapping
On Error Resume Next
'-- Initialize Return Code
FillGlobalVars = False
'--Get Variables
'--Get Subject
sSubject = "Registration"
'--Get From Address
sFrom = "webmaster@somewhere.com"
'--Get Recipient
sTo = "me@somwhere.com" 'Request("Email"
'Useless Fields For Harbrine
sCC = ""
sBcc = ""
'Message
sMessage = ""
sMessage = sMessage & "Thank you for registering with" & chr(13) & chr(10)
sMessage = sMessage & "This is an automated message. Replies will go unanswered."
'& vbCrLf & vbCrLf
'sMessage = sMessage & "Your login details are below" & vbCrLf & vbCrLf
'sMessage = sMessage & "Username : TEST" & vbCrLf '& Email & vbCrLf
'sMessage = sMessage & "Password : TEST" & vbCrLf '& PWord & vbCrLf
'--Trim fields
sFrom = Trim(sFrom)
sTo = Trim(sTo)
sCc = Trim(sCC)
sBcc = Trim(sBcc)
'-- Set Return Code
FillGlobalVars = True
End Function
'-- Now process the form-----------------------------------------------------------------------
Dim iResult
Dim bVarsOK
'-- fill the global variables
bVarsOK = FillGlobalVars()
If bVarsOK Then
' send the email
iResult = SendTheMail()
End If
'----Response Page-----
%>
<HTML>
<HEAD><TITLE>Form To Email ASP</TITLE></HEAD>
<BODY>
<H2>Form To Email ASP</H2>
<HR>
<P>
<%If bVarsOK Then%>
<%If iResult = mmeNone Then%>
<!--Mail sent successfully-->
The mail message was sent successfully.
<%Else%>
<!--Mail not sent successfully-->
The mail message could not be sent.<BR>
Error Code: <%= CStr( iResult ) %><BR>
Error Message: <%= mmeMessage(iResult) %>
<%End If%>
<%Else%>
<!--Mail could not be sent, required fields left blank-->
You had some bad data, in the field <%= sBadDataField %><BR>
Your mail was not sent.
<%End If%>
<P>
<HR>
</BODY>
</HTML>
Please Help!
Roberto
i am using AB Mailer (so this may not be place to write this is!?) to senf automated email messages to subscribers.
the problem is the meails are getting sent fine bu the message body is not appearing. Now if i sent it to something like hotmail then it puts the body as an attachement. to other email programs there is just no body at all?
Code:
<%LANGUAGE=VBScript%>
<%
'-- Global Variables
Dim sFrom ' email address of sender
Dim sTo ' email address of primary recipient(s)
Dim sCc ' email address(es) of CC recipient(s)
Dim sBcc ' email address(es) od blind CC recipients
Dim sSubject ' email subject line
Dim sMessage ' email message-text body
Dim sPriority ' priority of message
Dim sMT ' message type (text or HTML)
Dim sBadDataField ' field containing bad data
'---- Mailman Error Constants ----
Const mmeNone = 0 ' Mail delivered successfully to SMTP server
Const mmeUndefined = 1 ' Undefined (internal) error, out-of-memory, etc...
Const mmeWinsock = 2 ' Network, TCP/IP, or general socket error
Const mmeReplyTo = 3 ' Error in "ReplyTo" line. For version 2.0 no longer used (see mmeRecipient).
Const mmeSendTo = 4 ' Error in "SendTo" line. For version 2.0 no longer used (see mmeRecipient).
Const mmeSendCc = 5 ' Error in "SendCc" line. For version 2.0 no longer used (see mmeRecipient).
Const mmeServerAddr = 6 ' Error in "ServerAddr" line, Server not found, etc...
Const mmeServerPort = 7 ' Invalid Server Port ID (default SMTP is 25)
Const mmeAttachment = 8 ' Could not find one of the attachments. Refer to "ErrorMsg".
Const mmeAuthentication = 9 ' Error authenticating with SMTP server.
Const mmeRecipient = 10 ' Could not find one of the recipients. Refer to "ErrorMsg".
Const mmeEvaluationExpired = 11 ' Evaluation copy of ABMailer has expired. Please register your copy of ABMailer.
'---- Default Constants ----
Const mmdServerPort = 25 ' Default SMTP Server Port ID
'---- Mailman Error Code Strings ----
ReDim mmeMessage(11)
mmeMessage(0) = "Mail delivered successfully to SMTP server"
mmeMessage(1) = "Undefined (internal) error, out-of-memory, etc..."
mmeMessage(2) = "Network, TCP/IP, or general WinSock error"
mmeMessage(3) = "Error in 'ReplyTo' line. For version 2.0 no longer used (see mmeRecipient)."
mmeMessage(4) = "Error in 'SendTo' line. For version 2.0 no longer used (see mmeRecipient)."
mmeMessage(5) = "Error in 'SendCc' line. For version 2.0 no longer used (see mmeRecipient)."
mmeMessage(6) = "Error in 'ServerAddr' line, Server not found, etc..."
mmeMessage(7) = "Invalid Server Port ID (default SMTP is 25)"
mmeMessage(8) = "Could not find one of the attachments. Refer to 'ErrorMsg'."
mmeMessage(9) = "Error authenticating with SMTP server."
mmeMessage(10) = "Could not find one of the recipients. Refer to 'ErrorMsg'."
mmeMessage(11) = "Evaluation copy of ABMailer has expired. Please register your copy of ABMailer."
'-- Set a few default values
sPriority = 2
sMT = 0
sSubject = "Results from form on website"
'-- now get user defined details
%>
<!--#include file="./user.inc"-->
<%
'-- Define functions
'----SendTheMail()--------------------------------------------------------------------
Function SendTheMail()
'-- Allocate Variables
Dim objMail
'-- Set Error Trapping
On Error Resume Next
Err.Number = 0
'-- Create the Mailman Object
Set objMail = Server.CreateObject("ABMailer.Mailman"
'-- Set the Mail Properties
objMail.Clear
objMail.MailSubject = sSubject
objMail.FromAddress = sFrom
objMail.ReplyTo = sFrom
objMail.SendTo = sTo
objMail.SendCc = sCC
objMail.SendBcc = sBcc
objMail.ServerAddr = "mailhost.somwhere.co.uk"
objMail.ServerPort = "25"
objMail.MailMessage = sMessage
objMail.XPriority = sPriority
objMail.MessageType = 0
'-- Send email message
objMail.SendMail
'-- Set return value to error-code value (mmeNone = Success)
SendTheMail = objMail.ErrorCode
End Function
'----FillGlobalVars()------------------------------------------------------------
Function FillGlobalVars()
'-- Set Error Trapping
On Error Resume Next
'-- Initialize Return Code
FillGlobalVars = False
'--Get Variables
'--Get Subject
sSubject = "Registration"
'--Get From Address
sFrom = "webmaster@somewhere.com"
'--Get Recipient
sTo = "me@somwhere.com" 'Request("Email"
'Useless Fields For Harbrine
sCC = ""
sBcc = ""
'Message
sMessage = ""
sMessage = sMessage & "Thank you for registering with" & chr(13) & chr(10)
sMessage = sMessage & "This is an automated message. Replies will go unanswered."
'& vbCrLf & vbCrLf
'sMessage = sMessage & "Your login details are below" & vbCrLf & vbCrLf
'sMessage = sMessage & "Username : TEST" & vbCrLf '& Email & vbCrLf
'sMessage = sMessage & "Password : TEST" & vbCrLf '& PWord & vbCrLf
'--Trim fields
sFrom = Trim(sFrom)
sTo = Trim(sTo)
sCc = Trim(sCC)
sBcc = Trim(sBcc)
'-- Set Return Code
FillGlobalVars = True
End Function
'-- Now process the form-----------------------------------------------------------------------
Dim iResult
Dim bVarsOK
'-- fill the global variables
bVarsOK = FillGlobalVars()
If bVarsOK Then
' send the email
iResult = SendTheMail()
End If
'----Response Page-----
%>
<HTML>
<HEAD><TITLE>Form To Email ASP</TITLE></HEAD>
<BODY>
<H2>Form To Email ASP</H2>
<HR>
<P>
<%If bVarsOK Then%>
<%If iResult = mmeNone Then%>
<!--Mail sent successfully-->
The mail message was sent successfully.
<%Else%>
<!--Mail not sent successfully-->
The mail message could not be sent.<BR>
Error Code: <%= CStr( iResult ) %><BR>
Error Message: <%= mmeMessage(iResult) %>
<%End If%>
<%Else%>
<!--Mail could not be sent, required fields left blank-->
You had some bad data, in the field <%= sBadDataField %><BR>
Your mail was not sent.
<%End If%>
<P>
<HR>
</BODY>
</HTML>
Please Help!
Roberto