Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending multiple emails with asp and cdonts question????

Status
Not open for further replies.

maynard444

Programmer
Jul 1, 2003
13
0
0
US
Hello All,
I am wondering if there is a way that asp and cdonts can email more than one person from one asp page.
Here is what I want to do.
1. Collect information from a form and send to asp script.
2. ASP script will then send 2 emails with different formats to different addresses.

I found that just adding another mail object to the script and attempting to send it just piles it on top of the other email. I've tried using a loop to activate the different mail scripts one after the other with no luck. If anyone has a method some way of doing this, please let me know.
Thanks,
Heath
 
Hi,

I'm sure there is a way to do what you requested. Can u post your script. This will enable us to see exactly what you are doing and what you are getting right/wrong. The formats you mentioned above is not really clear to me. Is it the body format of the mail? I know this could be set to 0 and 1 respectively. Howz the mail object you are creating??

Please post your code for more clarity.

Regards,
Larryman

Oysterbar ride to success. Keep Riding
 
Here is the code for the asp page. This is the original code page with no modifications.
I'll clarify one point: I need two different emails to come from one asp page. The second email will go to another area, and have different information than the first email.


<!--#INCLUDE FILE=adovbs.inc-->
<%
Response.Write "<html><head><title></title><meta http-equiv=Content-Type content=text/html; charset=iso-8859-1></head>:"

Response.Write "<body bgcolor=#CCCCCC text=#000000>"

Dim adoCon 'Holds the Database Connection Object
Dim rsaddrec 'Holds the recordset for the new record to be added to the database
Dim strSQL 'Holds the SQL query for the database

Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../../../TechStuff/RequestForm/EmpDbase.mdb") &";"

'Create an ADO recordset object
Set rsaddrec = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT Terminations.Facility, Terminations.EffectiveDate, Terminations.LastDayWorked, Terminations.Name, Terminations.Supervisor, Terminations.DateTimeSubmitted FROM Terminations;"

rsaddrec.CursorLocation = adUseClient

'Open the tblComments table using the SQL query held in the strSQL varaiable
rsaddrec.Open strSQL, adoCon, adOpenStatic, adLockOptimistic, adCmdText


'Tell the recordset we are adding a new record to it
rsaddrec.AddNew

'Add new records to the recordset
rsaddrec.Fields("Facility") = Request.Form("Facility")
rsaddrec.Fields("EffectiveDate") = Request.Form("Effective_Date")
rsaddrec.Fields("LastDayWorked") = Request.Form("Last_Day_Worked")
rsaddrec.Fields("Name")=Request.Form("Employee_Name")
rsaddrec.Fields("Supervisor")=Request.Form("Supervisor")
rsaddrec.Fields("DateTimeSubmitted")=now()


'Write the updated recordset to the database
rsaddrec.UPDATE
varNewID = rsaddrec(0)

'Reset server objects
rsaddrec.Close
Set rsaddrec = Nothing
Set adoCon = Nothing



Response.Write "<table border=1>"
Response.Write "<tr><th colspan=2>Form Results</th>"
Response.Write "<tr><th>Employee Number</th><td>" & Request.Form("Employee_Number") & "</td></tr>"
Response.Write "<tr><th>Effective Date</th><td>" & Request.Form("Effective_Date") & "</td></tr>"
Response.Write "<tr><th>Employee Name</th><td>" & Request.Form("Employee_Name") & "</td></tr>"
Response.Write "<tr><th>Type</th><td>" & Request.Form("Type") & "</td></tr>"
Response.Write "<tr><th>Termination Reason</th><td>" & Request.Form("TerminationReason") & "</td></tr>"
Response.Write "<tr><th>Supervisor</th><td>" & Request.Form("Supervisor") & "</td></tr>"
Response.Write "<tr><th>Last Day Worked</th><td>" & Request.Form("Last_Day_Worked") & "</td></tr>"
Response.Write "<tr><th>Pay Through</th><td>" & Request.Form("Pay_through") & "</td></tr>"
Response.Write "<tr><th>Vacation Hours Due</th><td>" & Request.Form("Vacation_Hours_Due") & "</td></tr>"
Response.Write "<tr><th>Severance</th><td>" & Request.Form("Severance") & "</td></tr>"
Response.Write "<tr><th>Remarks</th><td>" & Request.Form("Remarks") & "</td></tr>"
Response.Write "<tr><th>Confirmation</th><td>" & Request.Form("Confirmation") & "</td></tr>"
Response.Write "</table>"
Response.Write "Submittal Date and Time: " & now()


Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")

HTML = HTML & "<HTML>"
HTML = HTML & "<HEAD>"
HTML = HTML & "<TITLE>Termination Form Results Confirmation</TITLE>"
HTML = HTML & "</HEAD>"
HTML = HTML & "<BODY bgcolor=""#DADADA"">"
HTML = HTML & "<h1>Form Results Confirmation</h1>"
HTML = HTML & "<table border=1>"
HTML = HTML & "<tr><th>Employee Number</th><td>" & Request.Form("Employee_Number") & "</td></tr>"
HTML = HTML & "<tr><th>Effective Date</th><td>" & Request.Form("Effective_Date") & "</td></tr>"
HTML = HTML & "<tr><th>Employee Name</th><td>" & Request.Form("Employee_Name") & "</td></tr>"
HTML = HTML & "<tr><th>Type</th><td>" & Request.Form("Type") & "</td></tr>"
HTML = HTML & "<tr><th>TerminationReason</th><td>" & Request.Form("TerminationReason") & "</td></tr>"
HTML = HTML & "<tr><th>Supervisor</th><td>" & Request.Form("Supervisor") & "</td></tr>"
HTML = HTML & "<tr><th>Last Day Worked</th><td>" & Request.Form("Last_Day_Worked") & "</td></tr>"
HTML = HTML & "<tr><th>Pay through</th><td>" & Request.Form("Pay_through") & "</td></tr>"
HTML = HTML & "<tr><th>Vacation Hours Due</th><td>" & Request.Form("Vacation_Hours_Due") & "</td></tr>"
HTML = HTML & "<tr><th>Severance</th><td>" & Request.Form("Severance") & "</td></tr>"
HTML = HTML & "<tr><th>Remarks</th><td>" & Request.Form("Remarks") & "</td></tr>"
HTML = HTML & "<tr><th>Confirmation</th><td>" & Request.Form("Confirmation") & "</td></tr>"
HTML = HTML & "</table>"
HTML = HTML & "Submittal Time and Date: " & now()
HTML = HTML & "<form name=form1 method=post action= HTML = HTML & "<input type=hidden name=Employee_Number value=""" & Request.Form("Employee_Number") & """>"
HTML = HTML & "<input type=hidden name=Effective_Date value=""" & Request.Form("Effective_Date") & """>"
HTML = HTML & "<input type=hidden name=Employee_Name value=""" & Request.Form("Employee_Name") & """>"
HTML = HTML & "<input type=hidden name=Type value=""" & Request.Form("Type") & """>"
HTML = HTML & "<input type=hidden name=TerminationReason value=""" & Request.Form("TerminationReason") & """>"
HTML = HTML & "<input type=hidden name=Supervisor value=""" & Request.Form("Supervisor") & """>"
HTML = HTML & "<input type=hidden name=Last_Day_Worked value=""" & Request.Form("Last_Day_Worked") & """>"
HTML = HTML & "<input type=hidden name=Pay_through value=""" & Request.Form("Pay_through") & """>"
HTML = HTML & "<input type=hidden name=Vacation_Hours_Due value=""" & Request.Form("Vacation_Hours_Due") & """>"
HTML = HTML & "<input type=hidden name=Severance value=""" & Request.Form("Severance") & """>"
HTML = HTML & "<input type=hidden name=Remarks value=""" & Request.Form("Remarks") & """>"
HTML = HTML & "<input type=hidden name=Confirmation value=""" & Request.Form("Confirmation") & """>"
HTML = HTML & "<input type=submit name=Complete value=Completed>"
HTML = HTML & "</form>"
HTML = HTML & "</body>"
HTML = HTML & "</HTML>"

objMail.From = Request.Form("Confirmation")
objMail.Subject = "Termination Form Results Confirmation"

objMail.BodyFormat = 0
objMail.MailFormat = 0

objMail.To = "datacentral@ciionline.com"
objMail.Body = HTML
objMail.Send

set objMail = nothing
Response.Write "</body>"
Response.Write "</html>"
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top