W3 Jmail

M

Mangler

I am new to Jmail/ASP and either need some help or someone to tell me I
am stupid...

I got Jmail to work fine. My problem is I need to send an email based
on somthing a customer submitted. When we receive the submission in
our system an auto-receipt email will be sent. What I need to have
happen (and cant figure out) is that email to include what was received
not just a on liner saying it was received. The information is pulled
from the db with a query. Anyone got any suggestions?

Danny
 
E

Evertjan.

Mangler wrote on 19 okt 2006 in microsoft.public.inetserver.asp.general:
I am new to Jmail/ASP and either need some help or someone to tell me I
am stupid...

I got Jmail to work fine. My problem is I need to send an email based
on somthing a customer submitted. When we receive the submission in
our system an auto-receipt email will be sent. What I need to have
happen (and cant figure out) is that email to include what was received
not just a on liner saying it was received. The information is pulled
from the db with a query. Anyone got any suggestions?

This is realy simple.

The jmail email is build up from asp code statements.

is you want to add a line based on variables that came from a
<form method='post'> in your submitter page, you can do this:

<% 'vbscript assumed


Set JMail = Server.CreateObject("JMail.SMTPMail")
......

JMail.Sender = Request.Form("email")
JMail.AddRecipient Request.Form("email")
JMail.Subject = "Received from: " & Request.Form("name")

JMail.Body = "Hi," & vbCrLf & vbCrLf & "You just entered:" & vbCrLf

JMail.AppendText Request.Form("email") & " (your emailaddress)" & vbCrLf
JMail.AppendText Request.Form("name") & " (your name)" & vbCrLf
JMail.AppendText Request.Form("street") & " (your street)" & vbCrLf

etc., etc.

JMail.Execute
.......
%>

Be careful to follow which statements need a = and which need arguments
without the =, see the specs.
 
M

Mangler

What if I need to have a repeat region in there to show all of the
contents received not just one line. Example order:

RMA#: 1057

lot# Part Desc Qty
1 flip 50
2 lcd 200
3 back 75
ETC....

The information above is coming from a query.
 
M

Mangler

Here is the code, maybe it will explain what I need better:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' Create the JMail message Object
set msg = Server.CreateObject( "JMail.Message" )

' Mail server requires sender and receiver data first
' Note that as addRecipient is method and not
' a property, we do not use an equals ( = ) sign
msg.From = "(e-mail address removed)"
msg.AddRecipient Request.Form("hdnemail")

' Get the form data
name = Request.Form("hdnname")
subject = "Repair Resource :: Auto-Receipt for RMA# " &
Request.Form("hdnrma")

' Enter the sender data
msg.FromName = "Repair Resource, Inc."

' Setup the correct mail sending user data
msg.MailServerUserName = "(e-mail address removed)"
msg.MailServerPassword = "**********"

' 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

' The subject of the message
msg.Subject = subject

' And the body
msg.body = "The contents of RMA#:" & Request.Form("hdnrma") & "have
been received into our system to be processed. Below are the results:"
$ vbCrlf & vbCrlF

(((??????????))))

%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rst_numRows = rst_numRows + Repeat1__numRows
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<meta http-equiv="refresh" content="5;URL=reclaimapp.asp">
<link href="../../style/style.css" rel="stylesheet" type="text/css" />
<link href="../../style/newRepairStyle.css" rel="stylesheet"
type="text/css" />
</head>

<body>
<form name="frmemail" id="frmemail" method="post" action="">
<font color="#000000" face="Verdana, Arial, Helvetica,
sans-serif"><font size="2">

<%
' Now send the message, using the indicated mailserver
if not msg.Send("mail.repairresource.com" )then
Response.write "<pre>" & msg.log & "</pre>"
else
Response.write "Your email confirmation message was sent
succesfully....Thank You!"
end if
' And we're done! the message has been sent.
%>
</font></font>
</form>
<p>&nbsp;</p>


</body>
</html>
 
M

Mangler

Sorry, got ahead of myself. Forgot to add the recordset. Updated code
as follows:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../../Connections/connReclaim.asp" -->
<%
Dim rsT__varR
rsT__varR = "1"
If (Request.QueryString("hdnrma") <> "") Then
rsT__varR = Request.QueryString("hdnrma")
End If
%>
<%
Dim rsT
Dim rsT_numRows

Set rsT = Server.CreateObject("ADODB.Recordset")
rsT.ActiveConnection = MM_connReclaim_STRING
rsT.Source = "select idlot, idrma, partdesc, partnum, phmodel, dockqty
from dbo.lotinfo where idrma = '" + Replace(rsT__varR, "'", "''") +
"'"
rsT.CursorType = 0
rsT.CursorLocation = 2
rsT.LockType = 1
rsT.Open()

rsT_numRows = 0
%>
<%
' Create the JMail message Object
set msg = Server.CreateObject( "JMail.Message" )

' Mail server requires sender and receiver data first
' Note that as addRecipient is method and not
' a property, we do not use an equals ( = ) sign
msg.From = "(e-mail address removed)"
msg.AddRecipient Request.Form("hdnemail")

' Get the form data
name = Request.Form("hdnname")
subject = "Repair Resource :: Auto-Receipt for RMA# " &
Request.Form("hdnrma")

' Enter the sender data
msg.FromName = "Repair Resource, Inc."

' Setup the correct mail sending user data
msg.MailServerUserName = "(e-mail address removed)"
msg.MailServerPassword = "sj5xvrnn"

' 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

' The subject of the message
msg.Subject = subject

' And the body
msg.body = "The contents of RMA#:" & Request.Form("hdnrma") & "have
been received into our system to be processed. Below are the results:"
$ vbCrlf & vbCrlF

AppendText

%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rst_numRows = rst_numRows + Repeat1__numRows
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<meta http-equiv="refresh" content="5;URL=reclaimapp.asp">
<link href="../../style/style.css" rel="stylesheet" type="text/css" />
<link href="../../style/newRepairStyle.css" rel="stylesheet"
type="text/css" />
</head>

<body>
<form name="frmemail" id="frmemail" method="post" action="">
<font color="#000000" face="Verdana, Arial, Helvetica,
sans-serif"><font size="2">

<%
' Now send the message, using the indicated mailserver
if not msg.Send("mail.repairresource.com" )then
Response.write "<pre>" & msg.log & "</pre>"
else
Response.write "Your email confirmation message was sent
succesfully....Thank You!"
end if
' And we're done! the message has been sent.
%>
</font></font>
</form>
<p>&nbsp;</p>


</body>
</html>
<%
rsT.Close()
Set rsT = Nothing
%>
 
E

Evertjan.

Mangler wrote on 19 okt 2006 in microsoft.public.inetserver.asp.general:
Sorry, got ahead of myself. Forgot to add the recordset. Updated code
as follows:
[.............]

[Please do not toppost on usenet]

Sorry, I am not going to analyze or write your code for you,
especially your database work,
that was not your OQ [original question].

You asked, I seem to remember, how to send a email on submission,
which has nothing to do with a database.

Try to send your info to the webpage for starters with multiple:

response write aLineOfText & "<br>"

and when that works as expected, change that to:

JMail.AppendText aLineOfText & vbCrLf

Read the jmail specs, thy have examples, I remember.

==============

Do you write or understand your own code, or do you
just use someone elses?
 
M

Mangler

I use dreamweaver and do the DB work. I wasnt asking you to write this
for me, sorry bout that. I have everything done but can't figure out
how to get the repeat region in the email.
 
E

Evertjan.

Mangler wrote on 19 okt 2006 in microsoft.public.inetserver.asp.general:

[Repeat request: Please do not toppost on usenet]
I use dreamweaver and do the DB work.

What has the database to do with your Q?

If you can get your info on screen with response.write,
you can get it in your mail with JMail.AppendText.

Do you agree?
if not, what is your agrument for that?
 
M

Mike Brind

If you want to get the recordset results to display in the email, I strongly
advise you to move away from Dreamweaver generated code and learn how to
create a recordset manually and output the results yourself. Until you
learn how to do this properly, and understand how it works, you will never
have the level of control that you would ideally want.

Dreamweaver's repeat regions are intended for the output of records into
html tables. I assume your email will be in plain text because you have
used & vbCrLf in the body, in which case html plays no part in it.
Consequently, a repeat region cannot be used in this context.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top