Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP CDO
|
ASP CDO As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP CDO section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 23rd, 2005, 02:15 PM
Registered User
 
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default HELP!! Problems sending email from ASP form

I have a form that displays several records that include email addresses. I would like to send to each email address the corresponding data but its not working. All the information is put in one email. How can I get it to send out one email with that reocrds' information? Below is the code for sending out the email.

<%



Dim strBody
Dim newMail
Dim oldMail


strBODY = strBODY & " Chargebacks List" & vbCrLf & vbCrLf


'================================================= ====================================
' Body of message


            strBODY = strBODY & "Item Number: " & Request.form("itemID") & vbCrLf
     strBODY = strBODY & "NAME: " & Request.form("GivenName") & vbCrLf
     strBODY = strBODY & "DATE: " & Request.form("date") & vbCrLf
            strBODY = strBODY & "Description: " & Request.form("Description") & vbCrLf
     strBODY = strBODY & "Budget#: " & Request.form("budget")& vbCrLf
     strBODY = strBODY & "Hours: " & Request.form("Hours") & vbCrLf
     strBODY = strBODY & "TOTAL DOLLARS: " & Request.form("TotalDollars") & vbCrLf
         strBODY = strBODY & "UNIT MANAGER: "& Request.form("ReportTo") & vbCrLf
         strBODY = strBODY & "UNIT MANAGER EMAIL: " & Request.form("ReportToemail") & vbCrLf

%>


<%


Dim myMail
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Chargeback Notification"
myMail.From="[email protected]"
myMail.To= Request.Form("ReportToemail")
myMail.TextBody=strBODY
myMail.Send

%>

<HTML>

<head>
<style>a {color:blue;}</style>
</head>

<table align="center" border="1" width="53%" cellspacing="0" cellpadding="0" height="52">
    <tr>
     <td width="100%" bgcolor="#FFC68C" height="10" valign="middle" align="center"><b>Confirmation</b></td>
    </tr>
    <tr>
     <td width="100%" height="40" valign="middle" align="center">Email sent successfully</td>
    </tr>
    <tr>

</tr>
<tr>
     <td width="100%" height="2" valign="middle" align="center" bgcolor="#FFC68C">
     <a href="chargeback_menu.htm">Return to menu</a></td>
    </tr>
</table>
</HTML>
 
Old March 24th, 2005, 01:04 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Looking at the code, it will send one email.
do you want to send all email address that appear in a single email?

If you want to send single mail to each email id, then u need to write a loop, which will pick data and send email.


Om Prakash
 
Old March 28th, 2005, 05:36 PM
Registered User
 
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by om_prakash
 Looking at the code, it will send one email.
do you want to send all email address that appear in a single email?

If you want to send single mail to each email id, then u need to write a loop, which will pick data and send email.


Om Prakash
I having a problem with creating the loop. The person to recieve the email may have more than one record of data. But for now I would be happy if the person recieved one email with one record.
Can you provide an example.
 
Old May 30th, 2005, 06:14 PM
Authorized User
 
Join Date: Aug 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sherief Send a message via Yahoo to sherief
Default

try using split to get the loop.

example:
'using commas to separate each email address
email_address = Request.Form("ReportToemail")

'then you can use:
arrEmail = split(email_address, ",")
countEmail = cdbl(ubound(arrEmail))

Dim myMail
'the loop:

for i = 1 to countEmail
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Chargeback Notification"
myMail.From="[email protected]"
myMail.To = arrEmail(i-1)
myMail.TextBody=strBODY
myMail.Send
set myMail = nothing
next

-----
Regards,
Sherief C. Mursyidi
http://www.sherief.net - Portal of IT pros





Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with sending email starfish2007 Pro PHP 0 June 6th, 2007 11:30 PM
ASP: Sending a HTML form to an email address cancer10 Classic ASP Databases 4 February 19th, 2007 05:25 PM
Got problems with sending email using php HELP rongfu84 Beginning PHP 3 January 8th, 2006 10:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.