Results 1 to 3 of 3

Thread: I need a mail example... Please

  1. #1
    Join Date
    Oct 2002
    Location
    california
    Posts
    25

    I need a mail example... Please

    The mail examples on the aspdb site are not working. and I can't seem to find a clear example of how to use the module.
    Thanks for your help

  2. #2
    Join Date
    Oct 2002
    Posts
    14
    <% response.buffer=true %>
    <!--#include virtual="/header.inc"-->
    <!--ASP-db-->
    <table width='100%' border=0><tr><td colspan='3' bgcolor='#CFE3F1' width='100%'>
    <a HREF='/default.asp'>FMI</a>&nbsp;&nbsp;<font color=#980053> > </font>&nbsp;&nbsp;<font color="#800080"><a HREF='directory.admin.asp'>Directory Administration</a></font>
    </td></tr></table>

    <FONT FACE="Times New Roman" Color=Black Size=-1>

    <CENTER>
    <%
    'LastButton = Mid( UCase( Request( "aspDBBut_1102" )), 10, 3 )
    Set MyDb = Server.CreateObject("Asp.DB")
    MyDb.dbUnit = 1102
    X=request("aspDBBut_1102")
    X=mid(UCASE(X),10,3)
    EF = "Name,Position,DateCreated,DateUpdated"
    If X = "ADD" then Session("ADDUPD") = "ADD"
    If X = "UPD" then Session("ADDUPD") = "UPD"

    If Session("ADDUPD") = "ADD" then
    EF = "last,first,username,gender,salutation,group_name, category,position,tel_office,tel_lab,address_lab[R-1066.],address_office[R-1066.],entry_fmi,depart_fmi,active,account_locked,web,bu dget,email[@fmi.ch],notes,updated[timestamp(mm/dd/yy)],added[timestamp(mm/dd/yy)]"
    ' Mydb.dbEditFlds = EF
    End If

    If Session("ADDUPD") = "UPD" then
    EF = "last,first,username,gender,salutation,group_name, category,position,tel_office,tel_lab,address_lab,a ddress_office,entry_fmi,depart_fmi,active,account_ locked,web,budget,email,notes,added,Updated[x|timestamp(mm/dd/yy)]"
    ' Mydb.dbEditFlds = EF
    End If

    Mydb.dbDSN = "FMI"
    MyDb.dbMode="both"
    MyDb.dbImageDir="../images/"

    Mydb.dbNavigation="both"
    Mydb.dbNavigationItem="Next, Prev, Gridrow, Filter, add, update, delete"
    NI = "gif, grid, form, top, prev, next, bottom, rowplus, rowminus, gridplus, gridminus,"
    NI = NI & "formplus, formminus, filter, resetfilter, download, color, reload,"
    NI = NI & "tables,edit,add,dot-white,dot-white" ' tables,edit,add,update,delete
    MyDb.dbNavigationIcon=NI
    MyDb.dbNavigation="both"
    dbGridColSortHideFlds="yy,zz"

    MyDb.dbDebug=0
    MyDb.dbSQL ="SELECT cid,last,first,gender,salutation,group_name,catego ry,position,tel_office,tel_lab,address_lab,address _office,entry_fmi,depart_fmi,account_locked,active ,web,budget,email,username,notes,updated,added,'xx ' as yy, 'z1' as zz FROM directory"
    MyDb.dbMagicCell = "yy,Align=CENTER,<A HREF=""#me#?aspDBBut_1102=aspDBEditUpdate::#ASPdbI ndex#&aspDBClick_1102=update""><IMG SRC=../../images/update.gif BORDER=0></A>;" & _
    "zz,Align=CENTER,<A HREF=""#me#?aspDBBut_1102=aspDBEditDelete::#ASPdbI ndex#&aspDBClick_1102=delete""><IMG SRC=../../images/delete.gif BORDER=0></A>;"
    MyDb.dbNameMap = "last,last name;first,first name;yy,&nbsp;zz,&nbsp;tel_office,office phone"
    MyDb.dbGridInc = 50
    MyDb.dbGridIndex=True
    MyDb.DBColor = "white,blue,#CFE3F1,#980053,#CFE3F1"
    MyDb.dbGridTableTag = "border=3 cellspacing=3 cellpadding=3"
    MyDb.dbFormTableTag = "border=3 cellspacing=3 cellpadding=3"
    MyDb.dbGridDisplayFlds="last,first,email,entry_fmi ,depart_fmi,username,added,updated,fmi_entry,yy,zz "
    MyDb.dbMemoTextSize = -1 'Format Memo (notes) to Text in order to display it in the grid/form
    EDF = "salutation,,directory_salutation,salutation,,,,,D istinct;" 'drop-down field
    EDF = EDF & "position,,directory_position,position,,,,,Distinc t;" 'drop-down field
    EDF = EDF & "category,,directory_category,category,,,,,Distinc t;" 'drop-down field
    EDF = EDF & "group_name,,directory_group_name,group_name,,,,,D istinct;" 'drop-down field
    EDF = EDF & "gender,,,/M/F;" 'drop-down field
    EDF = EDF & "active,,,yes/no;" 'drop-down field
    EDF = EDF & "web,,directory_web,web,,,,,Distinct;" 'drop-down field
    Mydb.dbEditDropFlds = EDF
    MyDb.dbEditFlds = EF
    MyDb.dbEditAddROFlds = "added,updated"
    MyDb.dbEditUpdateROFlds = "added,updated"
    'FFlds = "first,last,web"
    'MyDb.dbFilterFlds = FFlds
    MyDb.dbFilterParams = "EasyFilterText,Help=False,Assistant=False"
    'Mydb.dbEditParams = "TableName=People,TableTag=Border=2," & _
    ' "RecordScope= single,CriteriaSIZE=4x25,BookMarkFlds=Name+Age"
    'EP = "TableName=directory,BookMarkFlds=0,TableTag=Borde r=2"
    'EP = EP & ",RecordScope=single,CriteriaSize=4x25,EditSemiCol on=;"
    'Mydb.dbEditParams = EP
    Mydb.dbEditParams = "TableName=directory,TableTag=Border=2,BookMarkFld s=0"


    'email, begin
    ButtonCheck = Request("aspDBEditBut_1102")
    If ButtonCheck ="Add New Record" then ' This does an UNSTICKY ADD
    Mydb.ASPdb ' let the record get written
    ' Mydb.dbReset(1102)
    ' Response.clear
    set conntemp=server.createobject("adodb.connection")
    conntemp.open "DSN=fmi"
    sqltemp="SELECT MAX(cid) AS test6 FROM directory"
    set rsTemp=conntemp.execute(sqltemp)
    test7=request("first")
    test8=rsTemp("test6")
    test9=request("last")
    test10=request("group_name")
    test11=request("position")
    test12=request("username")
    test13=request("email")
    test14=len(trim(request("email")))-7

    sqltemp="SELECT * FROM directory_group_name where group_name=" & "'"&trim(test10)&"'"
    rsTemp=conntemp.execute(sqltemp)
    test15=rstemp("gname")

    Set Mail = Server.CreateObject("Persits.MailSender")
    Mail.Host = "imail.fmi.ch" ' Specify a valid SMTP server
    Mail.From = "help@fmi.ch" ' Specify sender's address
    Mail.FromName = "Computer Support (FMI)" ' Specify sender's name
    Mail.AddAddress "deanf@fmi.ch" ' Name is optional
    Mail.AddReplyTo "help@fmi.ch"
    Mail.Subject = "NEW USER " & test7 & " " & test9 & " TO ADD TO SYSTEM "
    Mail.Body = "" & Chr(13) & Chr(10) & _
    "Personnel has added a new person to the directory, " & test7 & " " & test9 & "," & Chr(13) & Chr(10) & _
    "from group " & test10 & ". Please run the following command to add them:" & Chr(13) & Chr(10) & _
    "/usr/local/scripts/adduser.sh -G " & test15 &" "& test12 &" '" & test9 & " " & test7 & " (FMI)'" & Chr(13) & Chr(10) & _
    "vi /etc/aliases and add " & left(lcase(test13),test14) & ":" & lcase(test12) & Chr(13) & Chr(10) & _
    "Then run newaliases and update the directory http://iwww.fmi.ch/directory/directo...rt_1102=added." & Chr(13) & Chr(10) & _
    "Then add the person to the appropriate e-mail list for " & test11 & "s." & Chr(13) & Chr(10) & _
    " " & Chr(13) & Chr(10)
    On Error Resume Next
    Mail.Send
    If Err <> 0 Then
    Response.Write "Error encountered: " & Err.Description
    End If

    'email, end
    Elseif Session("ADDUPD") = "UPD" and trim(request("active"))="no" then
    Mydb.ASPdb ' let the record get written
    test12=request("username")
    test7=request("first")
    test9=request("last")
    test10=request("group_name")
    test11=request("position")
    test12=request("username")
    test13=request("email")
    test14=len(trim(request("email")))-7
    dDate = Now()
    dDate = FormatDateTime(DateAdd( "d", 7, dDate ), vbShortDate)
    Set Mail = Server.CreateObject("Persits.MailSender")
    Mail.Host = "imail.fmi.ch" ' Specify a valid SMTP server
    Mail.From = "help@fmi.ch" ' Specify sender's address
    Mail.FromName = "Computer Support (FMI)" ' Specify sender's name
    Mail.AddAddress "deanf@fmi.ch" ' Name is optional
    Mail.AddReplyTo "help@fmi.ch"
    Mail.Subject = "LOCK USER ACCOUNT " & test12
    Mail.Body = "" & Chr(13) & Chr(10) & _
    "Personnel has set " & test7 & " " & test9 & " to inactive from group " & test10 & "." & Chr(13) & Chr(10) & _
    "Please lock the account with this command:" & Chr(13) & Chr(10) & _
    "/bin/passwd -l " & test12 & " or /usr/sbin/usermod -e " & dDate & " " & test12 & Chr(13) & Chr(10) & _
    "vi /etc/aliases and remove or forward: " & left(lcase(test13),test14) & ":" & lcase(test12) & " and " & test12 & Chr(13) & Chr(10) & _
    "Then run newaliases." & Chr(13) & Chr(10) & _
    "Set the account to locked in the directory http://iwww.fmi.ch/directory/directo...rt_1102=added." & Chr(13) & Chr(10) & _
    "Then remove the person from the appropriate e-mail list for " & test11 & "s." & Chr(13) & Chr(10) & _
    " " & Chr(13) & Chr(10)
    On Error Resume Next
    Mail.Send
    If Err <> 0 Then
    Response.Write "Error encountered: " & Err.Description
    End If
    Else
    MyDb.aspDB
    End If
    %>
    </center></font></body></html>
    <!--#include virtual="/footer.inc"-->

  3. #3
    Join Date
    Oct 2002
    Location
    california
    Posts
    25

    Thank you

    Thank you very much sir. Really good stuff!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •