Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional 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 November 27th, 2012, 07:29 AM
Registered User
 
Join Date: Nov 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP Email Notification

I'll appreciate any assistance on this. The scenario;

I have a database table with the following sample records;

data1-----------------dt2----data3------data4----------data5------data6
Brewing Plant-----2------10000------11/3/2012----1136-------person1@yahoo.com
Brewing Plant-----2------10000------11/3/2012----1136-------person1@yahoo.com
Car Plant-----------1------5000--------11/3/2012-----568--------person1@yahoo.com
Brewing Plant-----1------5000-------11/3/2012-----568--------person2@yahoo.com
Car Plant-----------4------20000------11/3/2012----2272-------person2@yahoo.com
Brewing Plant-----3------15000------11/3/2012----1704-------person3@yahoo.com

This is my requirement:
I want just one notification email each sent to theses various persons with their information. Please note that summations were done before the email was sent e.g;

Person1 should receive an email like
Data1--------------dt2----data5
Brewing Plant----4------2272
Car Plant----------1------568

while Person2 should receive an email like
Data1----------------dt2---data5
Brewing Plant-----1-----568
Car Plant-----------4-----2272
and so on.

I am using classic ASP and MySQL

Thanks for your anticipated assistance.
 
Old November 27th, 2012, 05:41 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

hi there. Im sorry I have not got time to write your code for you which seems to be what you are asking. FYI to get the best out of fourms you should always have a go, come to an issue and post the issues as they come up....

But what I have got is a little bit of code I used to send a bulk mal out fo everyone in a contacts table. Im sure you could:

> place your connection string at the top (myn is in a global file....)
> replace my query with oone that asks your DB/table for info
> replace my 'mailIP' variable with your SMTP IP address. (myn is in a global file....)
> Then replace the email content from the '.To' line
> after posting I also realised I left in the 'if mailEnabled' line in. this is also a global setting I use. Get rid of this and its 'else' 'end if'. Or add this:
Dim MailEnabled
MailEnabled - true

The code will work for you. Based on making the above changes it will work for you.

Code:
<% OPTION EXPLICIT %>
<%  Dim iMsg,iConf,Flds,strHTML,strSmartHost
    sql = "Select cName,cPhone,cEmail,cMessage,dateEntered from contactPage order by ID;"
    set getInfo = conn.execute(sql)
    if not getInfo.eof then
      if MailEnabled then
         Const cdoSendUsingPort = 2
         StrSmartHost = mailIP
         set iMsg     = CreateObject("CDO.Message")
         set iConf    = CreateObject("CDO.Configuration")
         Set Flds     = iConf.Fields
         With Flds
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
            .Update
         End With
       do until getInfo.eof
         With iMsg
            Set .Configuration = iConf
           .To       = getInfo(2)
           .From     = "info@elitemarquees.com.au"
           .Subject  = "Mail for " & getInfo(0)  & " from Elite Marquees"
           .HTMLBody = "<table border='0' align='center' width='600'>" & _
           "<tr><td>" & getInfo(1)  & "</td></tr>" & _
           "<tr><td><br><bR>Afternoon - we hope you are having a great day!  You have received this message because you have contacted Elite Marquees using our contacts page at www.elitemarquees.com.au.   Elite Marquees have recently joined the Facebook community and would like to invite you to visit our page to comment about your experiences with us.   Our page can be found at:</td></tr>" & _
           "<tr><td><br><br><a href='http://www.facebook.com/EliteMarquees' title='Click to visit Elite Marquees Facebook Page'>www.facebook.com/EliteMarquees</a></td></tr>" & _
           "<tr><td><br><bR>Or if you could simply ‘LIKE’ us by clicking the ‘LIKE’ button which can be found towards the bottom of any page on our website:</td></tr>" & _
           "<tr><td><br><br><a href='http://www.elitemarquees.com.au' title='Click to visit Elite Marquees website'>www.elitemarquees.com.au</a></td></tr>" & _
           "<tR><td><bR><br>Please accept my apologies if this email has inconvenienced you in any way.  As a reminder the initial enquiry you sent us was recieved on " & getInfo(4) & " </td></tr>" & _
           "<tr><td><br>Kind Regards<br>Matthew Burr<br>Elite Marquees<bR>W - <a href='http://www.elitemarquees.com.au' title='Click to visit Elite Marquees web site'>www.elitemarquees.com.au</a><bR>T - 0424 101 130</td></tr>" & _
           "</table>"
           .Send
         End With
         response.write "Mail sent to " & getInfo(0) & " (" & getInfo(2) & ")<br>"
         getInfo.moveNext
       loop         
      else
         response.write "mail is disabled"
      end if
    else
       response.write "no records found"
    end if
   conn.close
   set conn= nothing %>
__________________
Wind is your friend
Matt

Last edited by mat41; November 27th, 2012 at 05:44 PM..
 
Old November 28th, 2012, 03:49 AM
Registered User
 
Join Date: Nov 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default RE:ASP Email Notification

Quote:
Originally Posted by mat41 View Post
hi there. Im sorry I have not got time to write your code for you which seems to be what you are asking. FYI to get the best out of fourms you should always have a go, come to an issue and post the issues as they come up....

But what I have got is a little bit of code I used to send a bulk mal out fo everyone in a contacts table. Im sure you could:

> place your connection string at the top (myn is in a global file....)
> replace my query with oone that asks your DB/table for info
> replace my 'mailIP' variable with your SMTP IP address. (myn is in a global file....)
> Then replace the email content from the '.To' line
> after posting I also realised I left in the 'if mailEnabled' line in. this is also a global setting I use. Get rid of this and its 'else' 'end if'. Or add this:
Dim MailEnabled
MailEnabled - true

The code will work for you. Based on making the above changes it will work for you.

Code:
<% OPTION EXPLICIT %>
<%  Dim iMsg,iConf,Flds,strHTML,strSmartHost
    sql = "Select cName,cPhone,cEmail,cMessage,dateEntered from contactPage order by ID;"
    set getInfo = conn.execute(sql)
    if not getInfo.eof then
      if MailEnabled then
         Const cdoSendUsingPort = 2
         StrSmartHost = mailIP
         set iMsg     = CreateObject("CDO.Message")
         set iConf    = CreateObject("CDO.Configuration")
         Set Flds     = iConf.Fields
         With Flds
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
            .Update
         End With
       do until getInfo.eof
         With iMsg
            Set .Configuration = iConf
           .To       = getInfo(2)
           .From     = "info@elitemarquees.com.au"
           .Subject  = "Mail for " & getInfo(0)  & " from Elite Marquees"
           .HTMLBody = "<table border='0' align='center' width='600'>" & _
           "<tr><td>" & getInfo(1)  & "</td></tr>" & _
           "<tr><td><br><bR>Afternoon - we hope you are having a great day!  You have received this message because you have contacted Elite Marquees using our contacts page at www.elitemarquees.com.au.   Elite Marquees have recently joined the Facebook community and would like to invite you to visit our page to comment about your experiences with us.   Our page can be found at:</td></tr>" & _
           "<tr><td><br><br><a href='http://www.facebook.com/EliteMarquees' title='Click to visit Elite Marquees Facebook Page'>www.facebook.com/EliteMarquees</a></td></tr>" & _
           "<tr><td><br><bR>Or if you could simply ‘LIKE’ us by clicking the ‘LIKE’ button which can be found towards the bottom of any page on our website:</td></tr>" & _
           "<tr><td><br><br><a href='http://www.elitemarquees.com.au' title='Click to visit Elite Marquees website'>www.elitemarquees.com.au</a></td></tr>" & _
           "<tR><td><bR><br>Please accept my apologies if this email has inconvenienced you in any way.  As a reminder the initial enquiry you sent us was recieved on " & getInfo(4) & " </td></tr>" & _
           "<tr><td><br>Kind Regards<br>Matthew Burr<br>Elite Marquees<bR>W - <a href='http://www.elitemarquees.com.au' title='Click to visit Elite Marquees web site'>www.elitemarquees.com.au</a><bR>T - 0424 101 130</td></tr>" & _
           "</table>"
           .Send
         End With
         response.write "Mail sent to " & getInfo(0) & " (" & getInfo(2) & ")<br>"
         getInfo.moveNext
       loop         
      else
         response.write "mail is disabled"
      end if
    else
       response.write "no records found"
    end if
   conn.close
   set conn= nothing %>
Thanks, but this does not do any aggregation, I require one that will sum up data of a particular product then send an email
 
Old November 29th, 2012, 06:07 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Sorry if my post confused you. I said you would need to swap my sql for yours. Wouldn't you use the SUM function in your SQL to achieve this??

Your subject of the post says ASP Email, in your post you say you want help sending some content by email. I sent you the code for the email loop side of things. Im sorry if that wasnt clear. What was clear to me was that you needed some help with email code...
__________________
Wind is your friend
Matt
 
Old November 30th, 2012, 05:04 AM
Registered User
 
Join Date: Nov 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default RE: ASP Email Notification

I am sorry to have sent the wrong message, I actually meant the 'MySQL' portion of it and rendering it in ASP for email. Thanks for dropping some notes all the same. I got it solved alright.

Cheers

Quote:
Originally Posted by mat41 View Post
Sorry if my post confused you. I said you would need to swap my sql for yours. Wouldn't you use the SUM function in your SQL to achieve this??

Your subject of the post says ASP Email, in your post you say you want help sending some content by email. I sent you the code for the email loop side of things. Im sorry if that wasnt clear. What was clear to me was that you needed some help with email code...





Similar Threads
Thread Thread Starter Forum Replies Last Post
regarding login notification myself.panku ASP.NET 3.5 Professionals 0 July 27th, 2009 07:20 AM
help please, sending notification email in c# rsllc C# 1 May 29th, 2005 01:15 AM
Email Notification for Forums? drfunkie BOOK: ASP.NET Website Programming Problem-Design-Solution 0 September 30th, 2003 10:13 PM
SQL Errors - ASP Notification mindyjeanne All Other Wrox Books 0 September 27th, 2003 04:48 PM
suggestion for forum email notification n/a Forum and Wrox.com Feedback 33 June 6th, 2003 06:24 PM





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