Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2006
    Posts
    11
    Rep Power
    0

    Can you help me to fix this problem with sending form


    HI
    I write this ASP code to sent form to specific email
    Code:
    <%
    
    logon_user = ucase(Request("logon_user"))
    if instr(logon_user, "\") > 0 then
    	logon_user = Split(logon_user,"\")
    	IISNID= ucase(logon_user(1))
    end if
    
    strFromEmailAddress=IISNID
    
    
    Response.Buffer = True
    'Dimension variables
    Dim strBody 			'Holds the body of the e-mail
    Dim objCDOMail 			'Holds the mail server object
    Dim strMyEmailAddress 		'Holds your e-mail address
    Dim strReturnEmailAddress	'Holds the return e-mail address of the user
    
    
    
    
    
    strMyEmailAddress = "example@exchange.example.com"
    
    
    
    'Initialse strBody string with the body of the e-mail
    strBody = "<h1><center>Employee Concerns</center></h1>"
    strBody = strBody & "<br><br><b>Comments: - </b><br>" & Replace(Request.Form("comments"), vbCrLf, "<br>")
    
    
    'Send the e-mail
    
    'Create the e-mail server object
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
    
    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
    objCDOMail.From = strFromEmailAddress&"@exchange.example.com.sa"
    
    'Who the e-mail is sent to
    objCDOMail.To = strMyEmailAddress
    
    
    
    'Set the e-mail body format (0=HTML 1=Text)
    objCDOMail.BodyFormat = 0
    
    'Set the mail format (0=MIME 1=Text)
    objCDOMail.MailFormat = 0
    
    'Set the subject of the e-mail
    objCDOMail.Subject = Request.Form("subject") 
    
    'Set the main body of the e-mail
    objCDOMail.Body = strBody
    
    
    'Send the e-mail
    objCDOMail.Send
    	
    'Close the server object
    Set objCDOMail = Nothing
    %>
    how can I track this email in external file in other word
    I don't want to show this email from who, but If there is any problem with this email I can go to this external file and know who sent this email by the date



    can you help me in this issue please
    Last edited by Shadow Wizard; February 6th, 2006 at 09:21 AM. Reason: added [code] and [/code] tags around code - please do that yourself next.
  2. #2
  3. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2926
    hello computerMan and welcome to aspfree!
    I have no idea what you mean in your question, if you can explain better maybe
    I'll be able to help.
  4. #3
  5. No Profile Picture
    Contributing User
    ASP Mastermind (5000+ posts)

    Join Date
    Aug 2005
    Location
    North East, UK
    Posts
    6,191
    Rep Power
    141
    I think he wants a log of who sent an email and at what time.

    If you have a database then you can store the full thing in there
    emailID, to, from, date/time, title, content


    You could also do the same with a text file, but a database would be easier to lookup.
  6. #4
  7. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2006
    Posts
    11
    Rep Power
    0
    Originally Posted by degsy
    I think he wants a log of who sent an email and at what time.

    If you have a database then you can store the full thing in there
    emailID, to, from, date/time, title, content


    You could also do the same with a text file, but a database would be easier to lookup.



    thank you all for helping
    yes that is what I mean. now I have this code
    what I have to do ?
    where have I put it?

    sub logAction(strAction)

    set objFileSystem = createObject("scripting.fileSystemObject")

    set objFile = objFileSystem.OpenTextFile(Server.MapPath(ôlog.txt ", forAppending, true)

    objFile.writeLine strAction

    objFile.close

    set objFile = nothing

    set objFileSystem = nothing

    end sub
  8. #5
  9. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Jul 2005
    Location
    Oxford UK
    Posts
    3,897
    Rep Power
    993
    hi do something like this
    Code:
    <%
    
    logon_user = ucase(Request("logon_user"))
    if instr(logon_user, "\") > 0 then
    	logon_user = Split(logon_user,"\")
    	IISNID= ucase(logon_user(1))
    end if
    
    strFromEmailAddress=IISNID
    
    
    Response.Buffer = True
    'Dimension variables
    Dim strBody 			'Holds the body of the e-mail
    Dim objCDOMail 			'Holds the mail server object
    Dim strMyEmailAddress 		'Holds your e-mail address
    Dim strReturnEmailAddress	'Holds the return e-mail address of the user
    
    
    
    
    
    strMyEmailAddress = "example@exchange.example.com"
    
    
    
    'Initialse strBody string with the body of the e-mail
    strBody = "<h1><center>Employee Concerns</center></h1>"
    strBody = strBody & "<br><br><b>Comments: - </b><br>" & Replace(Request.Form("comments"), vbCrLf, "<br>")
    
    
    'Send the e-mail
    
    'Create the e-mail server object
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
    
    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
    objCDOMail.From = strFromEmailAddress&"@exchange.example.com.sa"
    
    'Who the e-mail is sent to
    objCDOMail.To = strMyEmailAddress
    
    
    
    'Set the e-mail body format (0=HTML 1=Text)
    objCDOMail.BodyFormat = 0
    
    'Set the mail format (0=MIME 1=Text)
    objCDOMail.MailFormat = 0
    
    'Set the subject of the e-mail
    objCDOMail.Subject = Request.Form("subject") 
    
    'Set the main body of the e-mail
    objCDOMail.Body = strBody
    
    
    'Send the e-mail
     on error resume next
    objCDOMail.Send
    if err <> 0 then
    			   
    				Log = "Not sent - " &strMyEmailAddress
    & " " & Error: "&err.description & "  " & date()& "  " & Time()
    			else
    			    Log = "Sent     - " &strMyEmailAddress
    & " " & " on "& Date() & " " & Time()
    			end if
    
                Call logAction(Log)	
    'Close the server object
    Set objCDOMail = Nothing
    %
    Nothing is Impossible bcoz IMPOSSIBLE itself says..
    I M POSSIBLE........................
    Be cool !!!!!!!!
  10. #6
  11. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2006
    Posts
    11
    Rep Power
    0
    thank you very much
    just I want to ask you another help because I am new in asp and what I want to complete this application that I have, do I have to create any text file?
    where can I find these emails?
  12. #7
  13. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Jul 2005
    Location
    Oxford UK
    Posts
    3,897
    Rep Power
    993
    u have already file log.txt in your root folder all the log entry must be in this file.......
  14. #8
  15. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2006
    Posts
    11
    Rep Power
    0
    Originally Posted by Guddu
    u have already file log.txt in your root folder all the log entry must be in this file.......


    what about this code, do I need it



    sub logAction(strAction)

    set objFileSystem = createObject("scripting.fileSystemObject")

    set objFile = objFileSystem.OpenTextFile(Server.MapPath(ôlog.txt ", forAppending, true)

    objFile.writeLine strAction

    objFile.close

    set objFile = nothing

    set objFileSystem = nothing

    end sub
  16. #9
  17. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Jul 2005
    Location
    Oxford UK
    Posts
    3,897
    Rep Power
    993
    yes bcoz your current log entry will be appented to this file log.txt...so u must be need this code to appent your log into log.txt file.......

    can u tell me the code given by me is working or not??
  18. #10
  19. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2006
    Posts
    11
    Rep Power
    0
    Originally Posted by Guddu
    yes bcoz your current log entry will be appented to this file log.txt...so u must be need this code to appent your log into log.txt file.......

    can u tell me the code given by me is working or not??

    unfortunatly it is not working
  20. #11
  21. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2006
    Posts
    11
    Rep Power
    0
    Originally Posted by computerMan
    unfortunatly it is not working


    and where do I launch my code
    sub logAction(strAction)

    set objFileSystem = createObject("scripting.fileSystemObject")

    set objFile = objFileSystem.OpenTextFile(Server.MapPath(ôlog.txt ", forAppending, true)

    objFile.writeLine strAction

    objFile.close

    set objFile = nothing

    set objFileSystem = nothing

    end sub
  22. #12
  23. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Jul 2005
    Location
    Oxford UK
    Posts
    3,897
    Rep Power
    993
    try this ..and what u are getting post here with all messages
    Code:
    <%
    sub logAction(strAction)
    
    set objFileSystem = createObject("scripting.fileSystemObject")
    
    set objFile = objFileSystem.OpenTextFile(Server.MapPath(ôlog.txt ", forAppending, true)
    
    objFile.writeLine strAction
    
    objFile.close
    
    set objFile = nothing
    
    set objFileSystem = nothing 
    
    end sub
    
    
    
    logon_user = ucase(Request("logon_user"))
    if instr(logon_user, "\") > 0 then
    	logon_user = Split(logon_user,"\")
    	IISNID= ucase(logon_user(1))
    end if
    
    strFromEmailAddress=IISNID
    
    
    'Response.Buffer = True
    'Dimension variables
    Dim strBody 			'Holds the body of the e-mail
    Dim objCDOMail 			'Holds the mail server object
    Dim strMyEmailAddress 		'Holds your e-mail address
    Dim strReturnEmailAddress	'Holds the return e-mail address of the user
    
    
    
    
    
    strMyEmailAddress = "example@exchange.example.com"
    
    
    
    'Initialse strBody string with the body of the e-mail
    strBody = "<h1><center>Employee Concerns</center></h1>"
    strBody = strBody & "<br><br><b>Comments: - </b><br>" & Replace(Request.Form("comments"), vbCrLf, "<br>")
    
    
    'Send the e-mail
    
    'Create the e-mail server object
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
    
    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
    objCDOMail.From = strFromEmailAddress&"@exchange.example.com.sa"
    
    'Who the e-mail is sent to
    objCDOMail.To = strMyEmailAddress
    
    
    
    'Set the e-mail body format (0=HTML 1=Text)
    objCDOMail.BodyFormat = 0
    
    'Set the mail format (0=MIME 1=Text)
    objCDOMail.MailFormat = 0
    
    'Set the subject of the e-mail
    objCDOMail.Subject = Request.Form("subject") 
    
    'Set the main body of the e-mail
    objCDOMail.Body = strBody
    
    
    'Send the e-mail
     on error resume next
    objCDOMail.Send
    if err <> 0 then
    			   
    				Log = "Not sent - " &strMyEmailAddress
    & " " & Error: "&err.description & "  " & date()& "  " & Time()
    			else
    			    Log = "Sent     - " &strMyEmailAddress
    & " " & " on "& Date() & " " & Time()
    			end if
    
                Call logAction(Log)	
    'Close the server object
    Set objCDOMail = Nothing
    %
  24. #13
  25. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2006
    Posts
    11
    Rep Power
    0
    Originally Posted by Guddu
    try this ..and what u are getting post here with all messages
    Code:
    <%
    sub logAction(strAction)
    
    set objFileSystem = createObject("scripting.fileSystemObject")
    
    set objFile = objFileSystem.OpenTextFile(Server.MapPath(ôlog.txt ", forAppending, true)
    
    objFile.writeLine strAction
    
    objFile.close
    
    set objFile = nothing
    
    set objFileSystem = nothing 
    
    end sub
    
    
    
    logon_user = ucase(Request("logon_user"))
    if instr(logon_user, "\") > 0 then
    	logon_user = Split(logon_user,"\")
    	IISNID= ucase(logon_user(1))
    end if
    
    strFromEmailAddress=IISNID
    
    
    'Response.Buffer = True
    'Dimension variables
    Dim strBody 			'Holds the body of the e-mail
    Dim objCDOMail 			'Holds the mail server object
    Dim strMyEmailAddress 		'Holds your e-mail address
    Dim strReturnEmailAddress	'Holds the return e-mail address of the user
    
    
    
    
    
    strMyEmailAddress = "example@exchange.example.com"
    
    
    
    'Initialse strBody string with the body of the e-mail
    strBody = "<h1><center>Employee Concerns</center></h1>"
    strBody = strBody & "<br><br><b>Comments: - </b><br>" & Replace(Request.Form("comments"), vbCrLf, "<br>")
    
    
    'Send the e-mail
    
    'Create the e-mail server object
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
    
    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
    objCDOMail.From = strFromEmailAddress&"@exchange.example.com.sa"
    
    'Who the e-mail is sent to
    objCDOMail.To = strMyEmailAddress
    
    
    
    'Set the e-mail body format (0=HTML 1=Text)
    objCDOMail.BodyFormat = 0
    
    'Set the mail format (0=MIME 1=Text)
    objCDOMail.MailFormat = 0
    
    'Set the subject of the e-mail
    objCDOMail.Subject = Request.Form("subject") 
    
    'Set the main body of the e-mail
    objCDOMail.Body = strBody
    
    
    'Send the e-mail
     on error resume next
    objCDOMail.Send
    if err <> 0 then
    			   
    				Log = "Not sent - " &strMyEmailAddress
    & " " & Error: "&err.description & "  " & date()& "  " & Time()
    			else
    			    Log = "Sent     - " &strMyEmailAddress
    & " " & " on "& Date() & " " & Time()
    			end if
    
                Call logAction(Log)	
    'Close the server object
    Set objCDOMail = Nothing
    %



    this is what I get(and I appreciate your help)



    Error Details:
    Error Number: -2146827256 (0x800A0408)
    Error Source: set objFile = objFileSystem.OpenTextFile(Server.MapPath(ôlog.txt ", forAppending, true)
    File Name: /application/send.asp
    Line Number: 7
    Brief Description: Invalid character
  26. #14
  27. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Jul 2005
    Location
    Oxford UK
    Posts
    3,897
    Rep Power
    993
    change your sub loaction with this
    Code:
    sub logAction(strAction)
    Const forAppending = 8
    set objFileSystem = createObject("scripting.fileSystemObject")
    
    set objFile = objFileSystem.OpenTextFile(Server.MapPath(ôlog.txt", forAppending))
    objFile.writeLine strAction
    
    objFile.close
    
    set objFile = nothing
    
    set objFileSystem = nothing 
    
    end sub
  28. #15
  29. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2006
    Posts
    11
    Rep Power
    0
    Originally Posted by Guddu
    change your sub loaction with this
    Code:
    sub logAction(strAction)
    Const forAppending = 8
    set objFileSystem = createObject("scripting.fileSystemObject")
    
    set objFile = objFileSystem.OpenTextFile(Server.MapPath(ôlog.txt", forAppending))
    objFile.writeLine strAction
    
    objFile.close
    
    set objFile = nothing
    
    set objFileSystem = nothing 
    
    end sub



    sorry to tell you that I have the same error
    do you think that error from my machine or sysytem that I am working on?
Page 1 of 2 12 Last
  • Jump to page:

Similar Threads

  1. Upoad file and form problem
    By artwise in forum ASP Development
    Replies: 4
    Last Post: March 10th, 2005, 11:42 PM
  2. tricky form submit problem
    By darsunt in forum ASP Development
    Replies: 5
    Last Post: February 11th, 2005, 04:41 PM
  3. Multi-Page Form and Redirect Problem
    By jbruso in forum ASP Development
    Replies: 5
    Last Post: October 1st, 2004, 01:45 AM
  4. Sending form results to a printer-friendly page
    By sengland in forum ASP Development
    Replies: 0
    Last Post: April 29th, 2003, 06:44 PM
  5. wierd form problem
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: October 15th, 2001, 10:40 AM

IMN logo majestic logo threadwatch logo seochat tools logo