Copy link to clipboard
Copied
can you tell me why my script will not process? I'm new to asp and jmail. Here is my code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@LANGUAGE = VBSCRIPT%> <html>
<body><%
'set Variables
Dim Subject
Dim SenderEmail
Dim RecipientSubject = "This is my form info to you"
SenderEmail = "form@domain.com"
Recipient = "me@mydomain.com"' Get the form data
Name = Request.Form("Name")
Address = Request.Form("Address")
City = Request.Form("City")
State = Request.Form("Sate")
Zip = Request.Form("Zip")
Email = Request.Form("Email")
Phone = Request.Form("Phone")
Have You Had Surgery = Request.Form("Have You Had Surgery")'create the body case information to be emailed
Select Case ucase(Subject)
case "Newsletter"
"Name: " & Name & vbCrLf &_
"Address: " & Address & vbCrLf &_
"City: " & City & vbCrLf &_
"State: " & State & vbCrLf &_
"Zip: " & Zip & vbCrLf &_
"Email: " & Email & vbCrLf &_
"Have You Had Surgery: " & Have You Had Surgery & vbCrLf &_
end Select' Create the JMail message Object
set msg = Server.CreateOBject( "JMail.Message" )' Set logging to true to ease any potential debugging
' And set silent to true as we wish to handle our errors ourself
msg.Logging = true
msg.silent = true' Enter the sender data
msg.From = SenderEmail' Note that as addRecipient is method and not
' a property, we do not use an equals ( = ) sign
msg.AddRecipient Recipient' The subject of the message
msg.Subject = Subject' And the body
msg.body = Newsletter
"Name: " & Name & vbCrLf &_
"Address: " & Address & vbCrLf &_
"City: " & City & vbCrLf &_
"State: " & State & vbCrLf &_
"Zip: " & Zip & vbCrLf &_
"Email: " & Email & vbCrLf &_
"Phone: " & Phone & vbCrLf &_
"Have You Had Weight Loss Surgery: " & Have You Had Weight Loss Surgery & vbCrLf &_' Now send the message, using the indicated mailserver
if not msg.Send("mail.trueresults.com" ) then
Response.write "<pre>" & msg.log & "</pre>"
else
Response.write "Message sent succesfully!"
end if
' And we're done! the message has been sent.
%>
</body>
</html>
Copy link to clipboard
Copied
Sorry, I've never used jmail. What exactly are the symptoms? Error message? Are you sure jmail is installed on your server? Why are you using jmail rather than CDOSYS?
Copy link to clipboard
Copied
OK, try this revised script. I have commented most of the changes and tested the script on my server to make sure it works. It wasn't clear from your code how the email body content is selected, so the following script reflects my own inference.
<%@LANGUAGE="VBSCRIPT" %>
<%
If Request("MM_Submit") <> "" Then ' If form has been submitted then process email script
strErr = ""
bValue = False
'set Variables
Dim Subject, SenderEmail, Recipient, UserName, Address, City, UserState, Zip, Email, Phone, Have_You_Had_Surgery, MessageBody
Subject = "Newsletter"
SenderEmail = "form@domain.com"
Recipient = "me@mydomain.com"
' Get the form data
UserName = Request.Form("UserName")
Address = Request.Form("Address")
City = Request.Form("City")
UserState = Request.Form("UserState")
Zip = Request.Form("Zip")
Email = Request.Form("Email")
Phone = Request.Form("Phone")
Have_You_Had_Surgery = Request.Form("Have_You_Had_Surgery")
'create the body case information to be emailed
Select Case Subject
case "Newsletter"
MessageBody = "Name: " & UserName & vbCrLf & "Address: " & Address & vbCrLf & "City: " & City & vbCrLf & "State: " & UserState & vbCrLf & "Zip: " & Zip & vbCrLf & "Email: " & Email & vbCrLf & "Have You Had Surgery: " & Have_You_Had_Surgery & vbCrLf
end Select
' Create the JMail message Object
set msg = Server.CreateOBject( "JMail.Message" )
' Set logging to true to ease any potential debugging
' And set silent to true as we wish to handle our errors ourself
msg.Logging = true
msg.silent = true
' Enter the sender data
msg.From = SenderEmail
' Enter login user name if required
msg.MailServerUserName = "me@mydomain.com"
' Enter password if required
msg.MailServerPassword = "password"
' Note that as addRecipient is method and not
' a property, we do not use an equals ( = ) sign
msg.AddRecipient Recipient
' The subject of the message
msg.Subject = Subject
' And the body
msg.body = MessageBody
' Now send the message, using the indicated mailserver
if not msg.Send("mail.trueresults.com" ) then
strErr= "<pre>" & msg.log & "</pre>"
else
bValue = True
end if
' And we're done! the message has been sent.
End If ' End If Request("MM_Submit") <> ""
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
<head>
<style type="text/css">
<!--
label { font-weight: bold; display:block }
input[type='text'] { width: 175px}-->
</style></head>
<body>
<% If strErr <> "" Then Response.Write("<p>Error occured:" & strErr & "</p>") End If %>
<% If bValue = True Then Response.Write("Message was sent successfully:<br> ") End If %>
<form action="" method="post">
<label>User Name: </label><input name="UserName" type="text" /><br />
<label>Address:</label><input name="Address" type="text" /><br />
<label>City:</label><input name="City" type="text" /><br />
<label>State:</label><input name="UserState" type="text" /><br />
<label>Zip:</label><input name="Zip" type="text" /><br />
<label>Email:</label><input name="Email" type="text" /><br />
<label>Phone:</label><input name="Phone" type="text" /><br />
<label>Have you had surgery?</label><input name="Have_You_Had_Surgery" type="text" /><br />
<label for="button"></label>
<input type="reset" name="MM_Reset" id="MM_Reset" value="Reset" />
<input name="MM_Submit" id="MM_Submit"type="submit" />
</form>
</body>
</html>
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more