For Programmers: Free Programming Magazines  


Home > Archive > ASP > October 2006 > W3 Jmail









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author W3 Jmail
Mangler

2006-10-30, 6:58 pm

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

Evertjan.

2006-10-30, 6:58 pm

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.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mangler

2006-10-30, 6:58 pm

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.


Evertjan. wrote:
> Mangler wrote on 19 okt 2006 in microsoft.public.inetserver.asp.general:
>
>
> 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.
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)


Mangler

2006-10-30, 6:58 pm

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 = "info@repairresource.com"
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 = "info@repairresource.com"
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> </p>


</body>
</html>






Mangler wrote:[color=darkred]
> 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.
>
>
> Evertjan. wrote:

Mangler

2006-10-30, 6:58 pm

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 = "info@repairresource.com"
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 = "info@repairresource.com"
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> </p>


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









Mangler wrote:[color=darkred]
> 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 = "info@repairresource.com"
> 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 = "info@repairresource.com"
> 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> </p>
>
>
> </body>
> </html>
>
>
>
>
>
>
> Mangler wrote:

Evertjan.

2006-10-30, 6:58 pm

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?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mangler

2006-10-30, 6:58 pm

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.


Evertjan. wrote:
>
> Do you write or understand your own code, or do you
> just use someone elses?
>


Evertjan.

2006-10-30, 6:58 pm

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

>
> Evertjan. wrote:

[Repeat request: Please do not toppost on usenet]
[color=darkred]
> 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?

> 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.




--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mike Brind

2006-10-30, 6:58 pm

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.

--
Mike Brind



"Mangler" <dwaldman@directwireless.com> wrote in message
news:1161281673.806521.141830@h48g2000cwc.googlegroups.com...
> 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 = "info@repairresource.com"
> 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 = "info@repairresource.com"
> 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> </p>
>
>
> </body>
> </html>
> <%
> rsT.Close()
> Set rsT = Nothing
> %>
>
>
>
>
>
>
>
>
>
> Mangler wrote:
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com