Alpha Video Training
Results 1 to 5 of 5

Thread: A little help please on email problem

  1. #1
    Member
    Real Name
    Steve Kent
    Join Date
    May 2011
    Posts
    139

    Default A little help please on email problem

    I am a beginner on programming so please forgive me for not having found the answer for this.

    I am trying to have the grid send an email after insert either to email address1 if between 6PM and 8AM and email address 2 if it is between 8 AM and 6PM.

    I am trying to establish the system time and then use if statement to assign an email address which I will use in the email code.

    The email part works fine for fixed email addresses but I am having trouble with the rest.

    Please let me know if you can spot my mistake..

    dim systime1 as c = time("h")
    dim emailaddress as c




    if systime1 < "08" .or. systime1 > "18"
    emailaddress = "xxx@yyy.com"
    else
    emailaddress = "zzz@yyy.com"
    end if


    pm.to = "emailaddress"

    I have left out code that isn't a part of the problem so please don't infer that I haven't the proper email protocol.

    Any ideas?

  2. #2
    Member
    Real Name
    Garry M Flanigan
    Join Date
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    909

    Default Re: A little help please on email problem

    Try:

    dim systime1 as n = val(time("h"))
    if systime1 < 8 .or. systime1 > 18
    emailaddress = "xxx@yyy.com"
    else
    emailaddress = "zzz@yyy.com"
    end if

  3. #3
    Member
    Real Name
    Steve Kent
    Join Date
    May 2011
    Posts
    139

    Default Re: A little help please on email problem

    Well, I gave that a try, I didn't get any errors but it didn't send an email either.

    Any other ideas?

  4. #4
    Member
    Real Name
    Garry M Flanigan
    Join Date
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    909

    Default Re: A little help please on email problem

    Your code does not send an email.

    However, the line:

    pm.to = "emailaddress"


    should be:

    pm.to = emailaddress


    (no quotes around emailaddress as it is a variable, not a value)

    I presume that pm.to is a snippet of more code that uses the function email_smtp_send()

  5. #5
    Member
    Real Name
    Steve Kent
    Join Date
    May 2011
    Posts
    139

    Default Re: A little help please on email problem

    That did it. Thank you so much. I originally had it that way but in the course of trying different things I added the quotes.

Similar Threads

  1. email problem
    By Mike Wilson in forum Alpha Five Version 7
    Replies: 6
    Last Post: 07-08-2009, 12:09 PM
  2. Email Problem - What's going on?
    By ronwills in forum Alpha Five Version 6
    Replies: 2
    Last Post: 11-01-2006, 09:27 PM
  3. email problem
    By johnm in forum Alpha Five Version 6
    Replies: 1
    Last Post: 04-22-2006, 04:49 AM
  4. email problem
    By Mike Vasilinda in forum Alpha Five Version 5
    Replies: 1
    Last Post: 07-14-2004, 04:43 PM
  5. email problem
    By Nick DiTrolio in forum Alpha Five Version 5
    Replies: 5
    Last Post: 02-27-2004, 05:09 AM

Bookmarks

Posting Permissions

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