Results 1 to 13 of 13

Thread: [02/03] Junk e-mail

  1. #1

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    [02/03] Junk e-mail

    My program that I am developing right now downloads e-mail messages from a POP3 server and parses the subject line to look for distinct numbers.

    For instance, if an email comes through with the subject line "05-905843" then it will split that into 2 parts ("05" being one part and "905843" the other part) and work with those numbers. I want to find out how I can determine if there is a junk mail that has entered the system and how I can ignore those exceptions?

  2. #2
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Re: [02/03] Junk e-mail

    The first thing you must do is define junk mail.

    Since it is (I believe) impossible to know whether an email is "junk" or not, you have to decide what you think is junk mail, and block that. That could mean blocking certain mailservers, or only allowing certain mailservers, or trying to parse the text and decide whether it is junk or not.

    So, what email do you consider to be "junk"?
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

  3. #3

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Re: [02/03] Junk e-mail

    junk mail in this situation would be anything where the subject line does not equal the format i specified above.

  4. #4
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Re: [02/03] Junk e-mail

    I've never made a mail client before. How are the storing the emails? Are you retrieving the emails and storing them in a dataset?
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

  5. #5

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Re: [02/03] Junk e-mail

    i'm using mailbee.net objects. I download the messages into a collection and write them as EML files. I'm not exactly talking about junk mail as the emails people get for cialis or viagra. I'm just saying any email that may be sent to that inbox that does not fit the format. For instance, if 2 emails are sent to the inbox with the subject lines 04-3843233 and the other one is "test email" then the test email subject line will need to be sent to another folder. I was just wondering how i can create an exception as to where the program detects the different pattern and throws the unwanted email into another folder.

  6. #6
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Re: [02/03] Junk e-mail

    I've used Mailbee.net (very recently), but only for outgoing mail. When you say you write them to an EML file, what do you mean?

    Basically, is there a part of your program where you are dealing with every email one at a time? Maybe when you are writing them to this EML file? If so, just check the subject then.

    If it's good, keep doing whatever it is you do with it, if not, send it somewhere else.
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

  7. #7

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Re: [02/03] Junk e-mail

    Yes, but what I don't understand how I can write an if statement that would successfully detect that the subject line has that correct format as xx-xxxxxxx. If it happens to be something else, then I want to throw it into another folder.

    As far as writing the EML files, that's not an issue. I just write the mail data into a text file but instead of naming it .txt, i just make it .eml. Thats all EML files really are anyway, but thats not the point. I'm just looking for some way that I can check to see if the subject line is in the proper format.

    The program I am trying to do sorts documents based upon the subject line of the email that is in an inbox that the program monitors.

    Also, why would you need to use mailbee.net for outgoing mail? Doesn't .net have built-in SMTP support?

  8. #8
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Re: [02/03] Junk e-mail

    I think 2005 does, but not 2003. Other than that, I don't know. That is the way they were doing it when I got here.
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

  9. #9
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [02/03] Junk e-mail

    you could start by checking the length of the subject line.

    If your filter should be XX-XXXXXXX where X is a number, then I would be checking if the subject line is 10 characters.

    If it is, then it should be checked further to see if 9 of those characters are numbers and if there is a - character in the 3rd position. Everything else would be considered junk, no?

  10. #10

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Re: [02/03] Junk e-mail

    Quote Originally Posted by 18experience
    I think 2005 does, but not 2003. Other than that, I don't know. That is the way they were doing it when I got here.
    v1.1 (2003) does have SMTP support... just not POP3 support. I used the built in SMTP in a program I developed last summer.

    Also, kleinma, I believe that will work... i was thinking something like that, but i was unsure about it. Let me try it and i'll post back.

  11. #11

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Re: [02/03] Junk e-mail

    Ok.. new question. Lets say for some odd reason that there is a subject line like te-stemail where there is a hyphen in the 3rd position, but there are characters instead of numbers in the string.. or maybe a mix of both. how do i make sure that each character is a number and not a letter?

  12. #12
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Re: [02/03] Junk e-mail

    Use Char.IsNumber() in conjunction with String.Substring() to check the first two, and the last seven.

    First, figure out how to get just the first two by themselves, then figure out how to get the last seven by themselves. Then take those two statements and put each in the parentheses for the IsNumber statement.

    So, something like,
    If Char.IsNumber(String.Substring(....)) And Char.IsNumber(String.Substring(...)) Then
    ...
    end if

    Also, you still need to check for the hyphen, and the length.
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

  13. #13
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [02/03] Junk e-mail

    here is a method I wrote that I use all the time to get numbers. It's great when you have a field like phone number that you want to format a specific way, but have no idea how the user will enter the data.

    Code:
    Public Function GetNumbersInString(ByVal text As String) As String
            Return System.Text.RegularExpressions.Regex.Replace(text, "\D+", String.Empty)
    End Function
    If you pass

    "123ABC456" to this method, you get back "123456"

    so if you passed your subject line, and you check the return value's .length property, it should be 9 when its a valid subject line...

Posting Permissions

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



Click Here to Expand Forum to Full Width