NEWBIE: How to create a log file

Discussion in 'ASP General' started by Tomas Vera, Sep 12, 2003.

  1. Tomas Vera

    Tomas Vera Guest

    Hello All,
    I'm new to ASP and am having problems with CDONTS.NewMail not always
    delivering my mail. Unfortunately, it always seems to fail on a
    particular recipient, so he's getting steamed!

    In my code, I create two e-mails, one to an end-user, and one to a
    sales rep. The e-mail to the user always succeeds, but the email to
    the sales reps fails about 15-25% of the time. I'm trying to debug the
    ASP page, and I figure using a log file may be the best way.

    I want to test the sales rep's newMail object and write to a log file
    when it fails (IsNull()), but I don't know how to create a log file in
    ASP. Example:

    Dim newMail
    newMail = Server.CreateObject ("CDONTS.NewMail")
    if(IsNull(newMail) then
    ' Code to write to a log file goes here
    ' Record the e-mail info for re-send later
    ' What goes here
    else
    ' Code to create the mail components goes here
    newMail.Send
    newMail = nothing
    end if

    I know this is super-simple and just need a quick code snippet.

    Thanks
    -tomas
    Tomas Vera, Sep 12, 2003
    #1
    1. Advertising

  2. Tomas Vera

    Tom B Guest

    Set newMail =
    rather than
    newMail=
    "Tomas Vera" <> wrote in message
    news:...
    > Hello All,
    > I'm new to ASP and am having problems with CDONTS.NewMail not always
    > delivering my mail. Unfortunately, it always seems to fail on a
    > particular recipient, so he's getting steamed!
    >
    > In my code, I create two e-mails, one to an end-user, and one to a
    > sales rep. The e-mail to the user always succeeds, but the email to
    > the sales reps fails about 15-25% of the time. I'm trying to debug the
    > ASP page, and I figure using a log file may be the best way.
    >
    > I want to test the sales rep's newMail object and write to a log file
    > when it fails (IsNull()), but I don't know how to create a log file in
    > ASP. Example:
    >
    > Dim newMail
    > newMail = Server.CreateObject ("CDONTS.NewMail")
    > if(IsNull(newMail) then
    > ' Code to write to a log file goes here
    > ' Record the e-mail info for re-send later
    > ' What goes here
    > else
    > ' Code to create the mail components goes here
    > newMail.Send
    > newMail = nothing
    > end if
    >
    > I know this is super-simple and just need a quick code snippet.
    >
    > Thanks
    > -tomas
    Tom B, Sep 12, 2003
    #2
    1. Advertising

  3. Tomas Vera

    Tomas Vera Guest

    On Fri, 12 Sep 2003 12:27:03 -0400, "Tom B" <>
    wrote:

    >Set newMail =
    >rather than
    >newMail=


    Sorry, bad typing. I am using the "Set=" notation.
    Now, about that log file......
    Tomas Vera, Sep 12, 2003
    #3
  4. Tomas Vera

    TomB Guest

    You could do this......
    http://www.15seconds.com/issue/990930.htm

    but that seems like a lot of work. I assume you just want to have a record
    of failed messages in a text file.

    Make sure you have write permissions on a directory then
    http://www.w3schools.com/asp/asp_ref_textstream.asp
    http://www.w3schools.com/asp/met_writeline.asp
    That ought to get you started.


    "Tomas Vera" <> wrote in message
    news:...
    > On Fri, 12 Sep 2003 12:27:03 -0400, "Tom B" <>
    > wrote:
    >
    > >Set newMail =
    > >rather than
    > >newMail=

    >
    > Sorry, bad typing. I am using the "Set=" notation.
    > Now, about that log file......
    TomB, Sep 12, 2003
    #4
  5. Tomas Vera

    Tomas Vera Guest

    Thanks!
    That's exactly what I was looking for.

    -tomas (posting via some web site!)



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Tomas Vera, Sep 12, 2003
    #5
  6. Tomas Vera

    dlbjr Guest

    Tom,

    Just curious -
    what email clients are they using?

    CDONTS email settings by default will not push to a Lotus Notes Client, but
    will work with many others like outlook.

    Here are settings to send email to a Lotus Domino Server.

    Set MailObj = CreateObject("CDONTS.NewMail")
    MailObj.MailFormat = 0
    MailObj.BodyFormat = 0
    MailObj.From = "me"
    MailObj.To = "you"
    MailObj.Subject = strSubject
    MailObj.Body = strMemo
    MailObj.Send

    -dlbjr

    invariable unerring alien
    dlbjr, Sep 13, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henrik_the_boss
    Replies:
    0
    Views:
    2,626
    Henrik_the_boss
    Nov 5, 2003
  2. Amratash
    Replies:
    0
    Views:
    497
    Amratash
    Apr 13, 2004
  3. =?Utf-8?B?VG9tIFdpbmdlcnQ=?=

    My.Log.Writeexception not writing to Application Event Log.

    =?Utf-8?B?VG9tIFdpbmdlcnQ=?=, Jan 20, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,350
    =?Utf-8?B?VG9tIFdpbmdlcnQ=?=
    Jan 20, 2006
  4. unomystEz
    Replies:
    0
    Views:
    529
    unomystEz
    Nov 19, 2006
  5. Leena Jethwa

    Create a log-in & log-out page

    Leena Jethwa, May 1, 2009, in forum: Ruby
    Replies:
    2
    Views:
    92
    Mike Stephens
    May 1, 2009
Loading...

Share This Page