Mail Going To Junk Folder

Use this forum for discussions about SpamAssassin and anti-spam in general.
User avatar
jimimaseye
Moderator
Moderator
Posts: 8154
Joined: 2011-09-08 17:48

Re: Mail Going To Junk Folder

Post by jimimaseye » 2018-08-19 13:05

Erm....

....how is this going to help? What is this going to acheive?

Spam mail comes in
You send back a 'Case Number...# ' email
It gets bounced (because it has gone to a 'noreply' or non-existant/spoofed account).

Am I missing something?
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-08-19 13:45

jimimaseye wrote:
2018-08-19 13:05
Am I missing something?
You have to watch the video. It's funny. The guy got signed up to a grocery store mailing list and went back and forth with the store with some funny stuff until they got fed up with his antics. Then for every message he sent he got a case number as the only reply. So he set up a script to auto reply with his own case number. The joke is both mail servers bouncing dueling case numbers infinitely. It's dumb but funny the way he told it.

Eh... I have to pay for a relay, so I'd run into bandwidth limits pretty fast. Could be fun if i had a static IP.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8154
Joined: 2011-09-08 17:48

Re: Mail Going To Junk Folder

Post by jimimaseye » 2018-08-19 14:18

Yes, I get that (I saw the video). My point is how are you going to implement this? As implied in my previous post, if it was left replying to all emails, or even just spam emails, then chaos and problems would ensue. So how will you implement this to target worthy inbound emails worth targeting (ie, the proverbial superstore "your case is..." email)? The bloke in the video would have written and targeted only the Superstore emails. If you are not getting such emails in the first place, how can you implement this with some degree of success (and amusement)?
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-08-19 16:36

It's the journey, not the destination. 8)

Edit - I have a wood shop at home and sometimes I tinker with completely useless "proof of concept" stuff, and I'm sure the case number script is the same. This totally negates my entire premise of woodworking - marrying form and function. So yeah, the journey... :mrgreen:

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-08-19 17:12

jimimaseye wrote:
2018-08-19 14:18
Yes, I get that (I saw the video). My point is how are you going to implement this? As implied in my previous post, if it was left replying to all emails, or even just spam emails, then chaos and problems would ensue. So how will you implement this to target worthy inbound emails worth targeting (ie, the proverbial superstore "your case is..." email)? The bloke in the video would have written and targeted only the Superstore emails. If you are not getting such emails in the first place, how can you implement this with some degree of success (and amusement)?
https://www.youtube.com/watch?v=c0bsKc4tiuY
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

User avatar
jimimaseye
Moderator
Moderator
Posts: 8154
Joined: 2011-09-08 17:48

Re: Mail Going To Junk Folder

Post by jimimaseye » 2018-08-19 17:39

I'm not denying it has a use at some point. But when? I am purely asking when or how you guys are going to implement this. When will you see a result and at what cost?

[Entered by mobile. Excuse my spelling.]
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-08-19 18:23

jimimaseye wrote:
2018-08-19 17:39
I'm not denying it has a use at some point. But when? I am purely asking when or how you guys are going to implement this. When will you see a result and at what cost?

[Entered by mobile. Excuse my spelling.]
It's actually on commision from The White House to combat Fake News ... But I'm not allowed to talk about it.
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-08-20 02:42

SorenR wrote:
2018-08-19 18:23
jimimaseye wrote:
2018-08-19 17:39
I'm not denying it has a use at some point. But when? I am purely asking when or how you guys are going to implement this. When will you see a result and at what cost?

[Entered by mobile. Excuse my spelling.]
It's actually on commision from The White House to combat Fake News ... But I'm not allowed to talk about it.
Did you get a red phone installed in your house?

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-08-21 23:04

I belive there is a bug in the unsubscribe code...

The two ".Subject=" lines should be switched. The line "On Error Resume Next" told VBScript to ignore any errors and just proceed. I noticed by chance that the output in my SMTP log and the hmailserver_events.log showed different results.

Change ...

Code: Select all

On Error Resume Next
With CreateObject("hMailServer.Message")
   .From = "Wile E. Coyote"
   .FromAddress = "wile.e.coyote@acme.inc"
   If UBound(a) > 0 Then
      .Subject = oMessage.Subject
   Else
      .Subject = Replace(a(1), "subject=", "")
   End If
   .AddRecipient a(0), a(0)
to this ...

Code: Select all

On Error Resume Next
With CreateObject("hMailServer.Message")
   .From = "Wile E. Coyote"
   .FromAddress = "wile.e.coyote@acme.inc"
   If UBound(a) > 0 Then
      .Subject = Replace(a(1), "subject=", "")
   Else
      .Subject = oMessage.Subject
   End If
   .AddRecipient a(0), a(0)
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-08-22 03:24

Done.

How did you see the subject line in your smtp log?

I'm using a relay svc and they keep headers for all messages. I looked up what got sent out today on a couple of messages sent by this script.

Message 1 mailto link had ?subject=unsubscribe but the message sent by the script had the original message subject instead of "unsubscribe".

Message 2 mailto link had NO ?subject=unsubscribe and the message sent by the script had no subject line at all.

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-08-22 13:01

Ah, it's my own custom SMTP logging. Not the regular SMTP log...

I don't get them that frequent... 99% only have the URL... So, 5 mails in 10 days...
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-08-22 15:06

I haven't had any hits since I fixed up the script last night, but after looking at the log results again, I'm wondering what happens when there is no ?subject= in the mailto link. If no subject is entered, the message could get marked as spam and not get delivered. Maybe it's good if "unsubscribe" is added as subject when there is no subject identified in the mailto link. Just a thought.

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-08-22 15:29

palinka wrote:
2018-08-22 15:06
I haven't had any hits since I fixed up the script last night, but after looking at the log results again, I'm wondering what happens when there is no ?subject= in the mailto link. If no subject is entered, the message could get marked as spam and not get delivered. Maybe it's good if "unsubscribe" is added as subject when there is no subject identified in the mailto link. Just a thought.
Script is supposed to use subject from <mailto: ... > or the original email subject. The bug caused subject to be blank if no subject found in <mailto: ... > and to use the original subject if subject is found in <mailto: ... >.

Sort of the logic behind this:

A programmer is going to the grocery store and his wife tells him, "Buy a gallon of milk, and if there are eggs, buy a dozen." So the programmer goes, buys everything, and drives back to his house. Upon arrival, his wife angrily asks him, "Why did you get 13 gallons of milk?" The programmer says, "There were eggs!"
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-08-22 15:35

Notice it's the wife that's angry. :lol: That actually happens to me with my wife sometimes and when I question her, she says I'm supposed to know.

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-08-22 15:55

palinka wrote:
2018-08-22 15:35
Notice it's the wife that's angry. :lol: That actually happens to me with my wife sometimes and when I question her, she says I'm supposed to know.
- The root is at the top of the tree!
- We objectify everything.
- Sleeping with a problem, can actually solve it.
- We know the difference between a String and a Thread.
- We're not all fat.
- COBOL programmers understand why women hate periods.
- Try telling this to a normal person: A parent may kill its children if the task assigned to them is no longer needed.

:mrgreen:
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-08-23 16:12

Working perfectly now. I had 2 hits since I update the script.

Message 1 had no mailto ?subject= and the original subject line was used in the message.

Message 2 had ?subject=unsubscribe in the mailto link and the subject line of the message was indeed unsubscribe.

Very happy. :D

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-09-01 12:14

palinka wrote:
2018-08-23 16:12
Very happy. :D
Could you try something for me?

Replace

Code: Select all

' <== debug
      For i = 0 To UBound(a)
         EventLog.Write( "UNSUB: a(" & i & ") = " & a(i) )
      Next
'     debug ==>
With

Code: Select all

' <== debug
      Dim b, j
      For i = 0 To UBound(a)
         EventLog.Write( "UNSUB: a(" & i & ") = " & a(i) )
         If UBound(a) > 0 Then
            b = Split(a(i), "&")
            For j = 0 To UBound(b)
               EventLog.Write( "UNSUB: b(" & j & ") = " & b(j) )
            Next
         End If
      Next
'     debug ==>
The reason is RFC6068, The 'mailto' URI Scheme: subject, cc, bcc, in-reply-to, body etc.. ?first &second &third etc...

I get one of these "extended" mailto's every 2-3 weeks, I just need figure out if I should do something about it. Otherwise I might as well do a complete RFC6068 interpretor thingy :wink:
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-09-01 12:34

I'll do it this morning. But I've never seen one with anything more than subject. At least, since I installed this and I've been paying attention.

On a side note, I receive a message yesterday marked as spam with a low score and I looked at the headers, as I always do with legit-looking messages marked as spam. There was no list-unsubscribe in the header. Otherwise, it looked 100% legit. I think that's the first legit one I've seen that didn't have any list-unsubscribe.

My rule to trigger is anything marked YES as spam AND below delete threshold. So for me that's between 3-8. Spamassassin does an excellent job at picking out malicious spam. Usually the trigger for this script is that it failed one of HMS spam tests, so the score is always 3 or 5 and a zero (below required_score of 5 from spamassassin). Therefore it's only operating on legitimate bulk list mail with minor issues. I'd run it on all mail below delete threshold but that might piss off a could of users.

That actually brings up an interesting question. Would a rule process on a non-existent header. E.g. if HMS spam score < 8, then run function. If it's not marked as spam, there's no header reporting a score. Maybe I'll test it to find out.

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-09-01 12:47

Follow-up ... Having actually READ most of RFC6068 I came across this:
4. Unsafe Header Fields

The user agent interpreting a 'mailto' URI SHOULD NOT create a
message if any of the header fields are considered dangerous; it MAY
also choose to create a message with only a subset of the header
fields given in the URI. Only a limited set of header fields such as
Subject and Keywords, as well as Body, are believed to be both safe
and useful in the general case. In cases where the source of a URI
is well known, and/or specific header fields are limited to specific
well-known values, other header fields MAY be considered safe, too.

The creator of a 'mailto' URI cannot expect the resolver of a URI to
understand more than the "subject" header field and "body". Clients
that resolve 'mailto' URIs into mail messages MUST be able to
correctly create [RFC5322]-compliant mail messages using the
"subject" header field and "body".
So, address, subject and body it is.

Running rules on "empty" headers is no problem. I do it all the time like; "IF X-hMailServer-Reason-Score Greater than 2" or "IF X-hMailServer-Spam Contains YES" ...

My "UCE Freak FIX" rule :mrgreen:
IF X-Spam-Flag Contains YES
AND
IF X-hMailServer-Spam NOT Contains YES
THEN
Set header value X-hMailServer-Spam YES
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-09-01 14:29

SorenR wrote:
2018-09-01 12:47
Running rules on "empty" headers is no problem. I do it all the time like; "IF X-hMailServer-Reason-Score Greater than 2" or "IF X-hMailServer-Spam Contains YES" ...
Right, but that's the opposite of the question. Both of those are positive statements. In both cases, a head value exists to evaluate.

My test will be:
1) HMS mark spam yes > 3
2) run rule if spam score < 8, do function
3) observe if rule processes when score < 3, for which there is no header value written.

In other words, does the rule process a null value? Null < 3?

User avatar
jimimaseye
Moderator
Moderator
Posts: 8154
Joined: 2011-09-08 17:48

Re: Mail Going To Junk Folder

Post by jimimaseye » 2018-09-01 14:42

I think it does.

Absent = null = no value = not greater than 3 = less than 3.
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-09-01 15:22

palinka wrote:
2018-09-01 14:29
Right, but that's the opposite of the question. Both of those are positive statements. In both cases, a head value exists to evaluate.
Nope ...
Attachments
rule.jpg
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-09-01 15:53

SorenR wrote:
2018-09-01 15:22
palinka wrote:
2018-09-01 14:29
Right, but that's the opposite of the question. Both of those are positive statements. In both cases, a head value exists to evaluate.
Nope ...
Sorry, I could have been more clear. Its evaluating the score based on the header value. If no header value present, score is null and rule is not triggered. That's what makes them positive values.

Example: what is your HMS mark spam score? If it's 2, then the rule will trigger on 2 or above but no header value exists for 0 or 1 because those values are below the mark spam score. If your mark spam score is 3 or higher, then 1 or 2 are null values and therefore the rule cannot be triggered.

null < 3

In my (untested) example, my mark spam score is 3 and the rule triggers on < 8. So will the rule trigger on 0, 1 or 2 (null values / negative values)? I'm going to set it up now and report back later. :D

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-09-01 16:00

Spam mark threshold = 3
Spam delete threshold = 1000

hMailServer do not deal in decimals so "> 2" means "equal to 3 or above" :wink:

Look at my rule again... "X-hMailServer-LoopCount Less than 1"... "X-hMailServer-LoopCount" is not created (OR updated) until mail has been forwarded internally one or more times.

So to answer your question. YES, IF "nothing" < 8 THEN ... WILL run the rule.
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-09-01 16:10

SorenR wrote:
2018-09-01 16:00
Spam mark threshold = 3
Spam delete threshold = 1000

hMailServer do not deal in decimals so "> 2" means "equal to 3 or above" :wink:
Exactly. And due to mark threshold, there is a x-hmailserver-spam-score header, not a null value.

In other words, if your spam mark threshold were 5, score > 2 would still not trigger until 5 because the score is under the threshold and the rule gets triggered off only-existing header values. 3 and 4 are null scores, and null < 2 (I think - I'll find out in a few minutes). :D

By the way, while setting up the test on 2 accounts known to receive lots of bulk email, I noticed the criteria test will trigger "match" with any letter. My criteria is spam score < 8, so "8" and "9" don't match but "d" or "p" DO MATCH. I guess that answers the question - any random letter is a null score.

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-09-01 16:13

SorenR wrote:
2018-09-01 16:00
Look at my rule again... "X-hMailServer-LoopCount Less than 1"... "X-hMailServer-LoopCount" is not created (OR updated) until mail has been forwarded internally one or more times.

So to answer your question. YES, IF "nothing" < 8 THEN ... WILL run the rule.
Ah, well there you go. Definitively YES.

I think I'll still keep the rule alive on these 2 accounts. They get way too much bulk mail. It's overflowing like a clogged toilet... :mrgreen:

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-09-01 16:37

palinka wrote:
2018-09-01 16:13
SorenR wrote:
2018-09-01 16:00
Look at my rule again... "X-hMailServer-LoopCount Less than 1"... "X-hMailServer-LoopCount" is not created (OR updated) until mail has been forwarded internally one or more times.

So to answer your question. YES, IF "nothing" < 8 THEN ... WILL run the rule.
Ah, well there you go. Definitively YES.

I think I'll still keep the rule alive on these 2 accounts. They get way too much bulk mail. It's overflowing like a clogged toilet... :mrgreen:
A little bit of Internet history :mrgreen:

http://www.todayifoundout.com/index.php ... k-message/
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-09-01 17:01

Funny:

Though not called spam, back then, telegraphic spam messages were extremely common in the 19th century in the United States particularly. Western Union allowed telegraphic messages on its network to be sent to multiple destinations. Thus, wealthy American residents tended to get numerous spam messages through telegrams presenting unsolicited investment offers and the like. This wasn’t nearly as much of a problem in Europe due to the fact that telegraphy was regulated by post offices in Europe.

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-09-26 17:27

Code update...

Code: Select all

Sub Unsubscribe(oMessage)
   '
   ' RFC6068 The 'mailto' URI Scheme: subject, cc, bcc, in-reply-to, body etc.. ?first &second &third etc...
   '
   Const            m_To = "UCE Agent"              ' or "Fucking low-life piece of SHIT!"
   Const        m_Sender = "Wile E. Coyote"         ' or "Postmaster"
   Const m_SenderAddress = "wile.e.coyote@acme.inc" ' or "postmaster@bofh.rocks"
   '
   Dim a, b, strRegEx, Match, Matches, sMailTo, sURL, m_Subject, m_Body, doMail, doURL
   strRegEx = "^[0-1]:[0-1]$"
   If Lookup(strRegEx, oMessage.HeaderValue("X-hMailServer-Unsubscribe")) Then
      a = Split(oMessage.HeaderValue("X-hMailServer-Unsubscribe"), ":")
      doMail = a(0)
      doURL = a(1)
   Else
      doMail = True
      doURL = True
   End If
   If doMail Then
      strRegEx = "([^\<]*?)(mailto:[\s\S]*?)(?=\>)"
      Set Matches = oLookup(strRegEx, oMessage.HeaderValue("List-Unsubscribe"), True)
      If Matches.Count > 0 Then
         For Each Match In Matches
            ' On Error Resume Next
            sMailTo = Mid(Trim(Match.Value), 8)
            a = Split(sMailTo, "?")
            If UBound(a) > 0 Then
               b = Split(a(1), "&")
               If (InStr(1, b(0), "subject=", 1) > 0) Then m_Subject = Replace(b(0), "subject=", "")
               If (InStr(1, b(0), "body=", 1) > 0) Then m_Body = Replace(b(0), "body=", "")
               If UBound(b) > 0 Then
                  If (InStr(1, b(1), "subject=", 1) > 0) Then m_Subject = Replace(b(1), "subject=", "")
                  If (InStr(1, b(1), "body=", 1) > 0) Then m_Body = Replace(b(1), "body=", "")
               End If
            End If
            With CreateObject("hMailServer.Message")
               .From = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
               .FromAddress = m_SenderAddress
               .AddRecipient a(0), a(0)
               .AddRecipient m_Sender, m_SenderAddress
               .HeaderValue("To") = Chr(34) & m_To & Chr(34) & " <" & a(0) & ">"
               .HeaderValue("CC") = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
                If Not m_Subject = Empty Then .Subject = m_Subject
                If Not m_Body    = Empty Then .Body    = m_Body
               .Save
            End With
            ' On Error Goto 0
            If (Err.Number <> 0) Then
               EventLog.Write( "ERROR: Sub Unsubscribe(oMessage)" )
               EventLog.Write( "Error       : " & Err.Number )
               EventLog.Write( "Error (hex) : 0x" & Hex(Err.Number) )
               EventLog.Write( "Source      : " & Err.Source )
               EventLog.Write( "Description : " & Err.Description )
               Err.Clear
               Exit Sub
            End If
         Next
      End If
   End If
   If doURL Then
      strRegEx = "([^\<]*?)((http|https):[\s\S]*?)(?=\>)"
      Set Matches = oLookup(strRegEx, oMessage.HeaderValue("List-Unsubscribe"), True)
      If Matches.Count > 0 Then
         For Each Match In Matches
            sURL = Trim(Match.Value)
            On Error Resume Next
            With CreateObject("MSXML2.ServerXMLHTTP.6.0")
               .setoption(2) = (.getoption(2) & " - SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS")
               .open "GET", sURL, False
               .setrequestheader "User-Agent", "online link validator (http://www.dead-links.com/)"
               .send ("")
            End With
            On Error Goto 0
            If (Err.Number <> 0) Then
               EventLog.Write( "ERROR: Sub Unsubscribe(oMessage)" )
               EventLog.Write( "Error       : " & Err.Number )
               EventLog.Write( "Error (hex) : 0x" & Hex(Err.Number) )
               EventLog.Write( "Source      : " & Err.Source )
               EventLog.Write( "Description : " & Err.Description )
               Err.Clear
               Exit Sub
            End If
         Next
      End If
   End If
End Sub
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-09-29 00:28

Muchisimas Gracias!!

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-12-16 22:43

I have a question. It doesn't appear that my unsubscribe messages are having any affect. I think they're getting caught in a spam filter. Here is an example of the ENTIRE message:

Code: Select all

Return-Path: spam@mydomain.tld
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
From: "DO NOT SPAM" <spam@mydomain.tld>
To: "SPAMMER" <unsubscribe-YQpglLjHJlTQGzbAzen6D1Bt1zg9zazao4T6HntTzbe1IBDieX4dzdSHRBFqjpOnzc5BrIqnmWcL8cyK7ORs0zaG@imh.rsys2.com>
CC: "DO NOT SPAM" <spam@mydomain.tld>
Subject: List-Unsubscribe
Date: Fri, 14 Dec 2018 12:15:35 -0500
mydomain.tld has working DKIM signing and valid SPF. HMS scores spam at 3. The unsubscribe rule is all messages marked spam but less than delete threshold should run the unsubscribe script.

I get copies of all spam for sorting (even those deleted). Before, I had a lot of messages marked spam due to HMS scoring them for DKIM fail. I have since disabled DKIM as a spam indicator for HMS (SA still looks at DKIM).

I'm getting a lot of list messages that should have been unsubscribed long ago, in part due to false positives by HMS scoring DKIM fail, triggering the unsubscribe script. For example, there were several users on the spamassissin user list that triggered the unsubscribe script via DKIM fail every time. Yet, I was never removed from the list. There are others as well (commercial stuff).

The script is working perfectly, as you can see from the example message above. I think the problem is that the word "SPAM" appears in both m_Sender and m_SenderAddress (both of which I just changed), plus the fact that the body is empty is causing these messages to get caught in recipient spam filters. The body thing in particular is a big one for SA, at least.

I'm not sure where to put a message for the body. Here's what I have:

Code: Select all

            If UBound(a) > 0 Then
               b = Split(a(1), "&")
               If (InStr(1, b(0), "subject=", 1) > 0) Then m_Subject = Replace(b(0), "subject=", "")
               If (InStr(1, b(0), "body=", 1) > 0) Then m_Body = Replace(b(0), "body=", "")
               If UBound(b) > 0 Then
                  If (InStr(1, b(1), "subject=", 1) > 0) Then m_Subject = Replace(b(1), "subject=", "")
                  If (InStr(1, b(1), "body=", 1) > 0) Then m_Body = Replace(b(1), "body=", "This is an automated message generated by our unsubscriber algorithym. Please do not respond to this email as it will be ignored.")
               End If
            End If

Am I in the right direction?

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-12-17 00:13

Nah... I believe this should do it...

Code: Select all

            With CreateObject("hMailServer.Message")
               .From = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
               .FromAddress = m_SenderAddress
               .AddRecipient a(0), a(0)
               .AddRecipient m_Sender, m_SenderAddress
               .HeaderValue("To") = Chr(34) & m_To & Chr(34) & " <" & a(0) & ">"
               .HeaderValue("CC") = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
                If Not m_Subject = Empty Then .Subject = m_Subject
                If Not m_Body    = Empty Then
                   .Body = m_Body
                Else
                   .Body = "This is an automated message generated by our unsubscriber algorithym. Please do not respond to this email as it will be ignored."
                End If
               .Save
            End With
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-12-17 00:53

Awesome. Thanks! Going to try it now (and hope I don't kick myself off the SA mailing list LOL).

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-12-17 16:22

Got my first hit - Kmart.

Code: Select all

Return-Path: unsubscribe@domain.tld
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
From: "Unsubscriber Daemon" <unsubscribe@domain.tld>
To: "List Administrator" <unsubscribe-YQpglLjHJlTQGhs5cbWzgYtTEjrNBzeOzecSNKzeUzb1pJT1Xt6GmI0KNctejezgU3HEIkzdPKR1f5ofA3U4R@imh.rsys2.com>
CC: "Unsubscriber Daemon" <unsubscribe@domain.tld>
Subject: List-Unsubscribe
Content-Transfer-Encoding: quoted-printable
Date: Mon, 17 Dec 2018 09:06:55 -0500
X-hMailServer-LoopCount: 1

This is an automated message generated by our unsubscriber algorithym. Please do not respond to this email as it will be ignored.
Let's see. I'm going to keep my eyes open for Kmart UCE.

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-12-18 17:13

Got another message from Kmart via shopyourway.com. And one from sears. They seem to be in cahoots. In any case, I found the reason why the unsubscribe didn't work - these sharers simply don't honor unsubscribe requests.
how do i unsubscribe to shop your way???

can't find anything on the web site as to how I can cancel my subscription

5 Answers
Becky myers
Becky myers
February 11th, 2014
It is impossible to unsubscribe from your shop your rewards email spam. I have been trying for over a year ans made many phone calls to your customer support. They tell me that my email address is not in your data base but I keep receiving your spam. I will NEVER shop at Sears or Kmart again. I had to cancel my years old email account to stop your spam. Please go out of business. SOON!
Above found on a search. Looks like I'll have to blacklist these flukes.

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-12-18 18:33

palinka wrote:
2018-12-18 17:13
Got another message from Kmart via shopyourway.com. And one from sears. They seem to be in cahoots. In any case, I found the reason why the unsubscribe didn't work - these sharers simply don't honor unsubscribe requests.
how do i unsubscribe to shop your way???

can't find anything on the web site as to how I can cancel my subscription

5 Answers
Becky myers
Becky myers
February 11th, 2014
It is impossible to unsubscribe from your shop your rewards email spam. I have been trying for over a year ans made many phone calls to your customer support. They tell me that my email address is not in your data base but I keep receiving your spam. I will NEVER shop at Sears or Kmart again. I had to cancel my years old email account to stop your spam. Please go out of business. SOON!
Above found on a search. Looks like I'll have to blacklist these flukes.
Welcome to the real world :mrgreen:

In Denmark we have a goverment body we can forward these messages to and when they get enough, they issue a hefty fine.

With the newly mandated GDPR, the consumer is granted a fair amount of power over spammers. HOWEVER ... GDPR has done more negative than positive wrt. SPAM fighting and WHOIS statistics. It have become increasingly difficult to identify SPAMMERS based on their domain info. :roll:

One good thing is that SpamAssassin rules is using ASN data for the Bayesian filter. ASN data identify any given Internet Acces router.

https://www.techopedia.com/definition/2 ... number-asn
https://www.ultratools.com/tools/asnInfo

On a side note... I just did a search in my SPAM account and I have NO TRACE of the header "X-Spam-ASN:" prior to September 28 2018. This particular SPAM folder is dating back to May 1'st 2016 :mrgreen:
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-12-18 19:14

SorenR wrote:
2018-12-18 18:33

Welcome to the real world :mrgreen:
Exactly. I've really come around to the idea of gdpr. It would be nice to have something like that in the US but I'm sure they would find a way to turn it completely on its head. I can literally imagine spammers getting paid and spamees getting fined for complaining.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8154
Joined: 2011-09-08 17:48

Re: Mail Going To Junk Folder

Post by jimimaseye » 2018-12-18 23:00

palinka wrote:
2018-12-18 19:14
SorenR wrote:
2018-12-18 18:33

Welcome to the real world :mrgreen:
Exactly. I've really come around to the idea of gdpr. It would be nice to have something like that in the US but I'm sure they would find a way to turn it completely on its head. I can literally imagine spammers getting paid and spamees getting fined for complaining.
I agree. Gdpr wouldn't be introduced in the U.S as it would hinder their political campaigning system. Mind you, Trump would get his mate Putin to send in his spam to get around the rules and blame his lawyer if he got found out.

Oops
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-12-18 23:52

jimimaseye wrote:
2018-12-18 23:00
I agree. Gdpr wouldn't be introduced in the U.S as it would hinder their political campaigning system.
Its not even that. The corruption here is now completely absurd.

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-12-19 00:17

Well...

Europeans (Citizens of EU) are INDIVUALS, PERSONS with free speach and total ownership of their personal data/Internet presence.

In the good ol' US of A, citizens are PRODUCTS. They have NO RIGHTS. True Orwellian. So true... :wink:

In Denmark we have this really old law, that allow us to express our opinion publicly - albeit with some with limitations.
Eg. I can address an armed police officer and say "I think you are an idiot" and all she can do is say "ok". However, saying "You are an idiot" can get me into all sorts of trouble, as I'm stating a fact, not an opinion.

I dare you to do the same and we'll do a tally on Friday to see how many of us (still) live in "the free world". :mrgreen:
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-12-19 02:14

You won't find any dispute from me. :(

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-12-29 15:31

SorenR wrote:
2018-12-17 00:13
Nah... I believe this should do it...

Code: Select all

            With CreateObject("hMailServer.Message")
               .From = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
               .FromAddress = m_SenderAddress
               .AddRecipient a(0), a(0)
               .AddRecipient m_Sender, m_SenderAddress
               .HeaderValue("To") = Chr(34) & m_To & Chr(34) & " <" & a(0) & ">"
               .HeaderValue("CC") = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
                If Not m_Subject = Empty Then .Subject = m_Subject
                If Not m_Body    = Empty Then
                   .Body = m_Body
                Else
                   .Body = "This is an automated message generated by our unsubscriber algorithym. Please do not respond to this email as it will be ignored."
                End If
               .Save
            End With
One more tidbit if you wouldn't mind having a look. I noticed that at least one outgoing unsubscribe message did not have a subject line, which is, of course, a reason for spam rejection, so I added it. Your blessing or correction is greatly appreciated.

Code: Select all

            With CreateObject("hMailServer.Message")
               .From = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
               .FromAddress = m_SenderAddress
               .AddRecipient a(0), a(0)
               .AddRecipient m_Sender, m_SenderAddress
               .HeaderValue("To") = Chr(34) & m_To & Chr(34) & " <" & a(0) & ">"
               .HeaderValue("CC") = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
                If Not m_Subject = Empty Then 
				   .Subject = m_Subject
				Else
                   .Subject = "Unsubscribe"
                If Not m_Body    = Empty Then
                   .Body = m_Body
                Else
                   .Body = "This is an automated message generated by our unsubscriber algorithym. Please do not respond to this email as it will be ignored."
                End If
               .Save

You know it's monkey see monkey do for me. :mrgreen:

User avatar
SorenR
Senior user
Senior user
Posts: 3210
Joined: 2006-08-21 15:38
Location: Denmark

Re: Mail Going To Junk Folder

Post by SorenR » 2018-12-29 19:28

Try this...

Code: Select all

            With CreateObject("hMailServer.Message")
               .From = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
               .FromAddress = m_SenderAddress
               .AddRecipient a(0), a(0)
               .AddRecipient m_Sender, m_SenderAddress
               .HeaderValue("To") = Chr(34) & m_To & Chr(34) & " <" & a(0) & ">"
               .HeaderValue("CC") = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
                If Not m_Subject = Empty Then
                   .Subject = m_Subject
                Else
                   .Subject = "Unsubscribe"
                EndIf
                If Not m_Body    = Empty Then
                   .Body = m_Body
                Else
                   .Body = "This is an automated message generated by our unsubscriber algorithym. Please do not respond to this email as it will be ignored."
                End If
               .Save
            End With
or this...

Code: Select all

            With CreateObject("hMailServer.Message")
               .From = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
               .FromAddress = m_SenderAddress
               .AddRecipient a(0), a(0)
               .AddRecipient m_Sender, m_SenderAddress
               .HeaderValue("To") = Chr(34) & m_To & Chr(34) & " <" & a(0) & ">"
               .HeaderValue("CC") = Chr(34) & m_Sender & Chr(34) & " <" & m_SenderAddress & ">"
               .Subject = "Unsubscribe"
                If Not m_Subject = Empty Then .Subject = m_Subject
               .Body = "This is an automated message generated by our unsubscriber algorithym. Please do not respond to this email as it will be ignored."
                If Not m_Body    = Empty Then .Body = m_Body
               .Save
            End With
https://ss64.com/vb/if.html
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1182
Joined: 2017-09-12 17:57

Re: Mail Going To Junk Folder

Post by palinka » 2018-12-29 19:43

Muchisimas gracias, spasiba and köszönöm. I thought there might be an "end if" required but monkey see monkey do....

User avatar
mattg
Moderator
Moderator
Posts: 20216
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Mail Going To Junk Folder

Post by mattg » 2018-12-30 03:35

palinka wrote:
2018-12-29 19:43
Muchisimas gracias, spasiba and köszönöm. I thought there might be an "end if" required but monkey see monkey do....
Not where the IF and the THEN are both on one line

ENDIF is only needed when the IF statement stretches across multiple lines
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Post Reply