Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get mails sent via Network.Mail.Mime classified not as junk?

I use lib Network.Mail.Mime to send emails from my Haskell program. I reckon it uses postfix to send the emails. When I try to send mails to my gmail address I do receive them, only they are in the junk, and this happens whatever I fill the "form" fill with. How can I avoid this behavior? Thx

like image 309
nschoe Avatar asked Jan 25 '26 08:01

nschoe


1 Answers

The mime-mail interface will send email, via sendmail, using the simple api:

{-# LANGUAGE OverloadedStrings #-}

import Data.Text
import Network.Mail.Mime

main = do
    simpleMail
        "[email protected]"
        "[email protected]"
        "Test"
        "This is a test"
        ""
        []

assuming you're correctly using Data.Text to avoid locale encoding issues.

Now, this is likely to set insufficient headers, so the spam filter will hit it. You may need to ask gmail to not classify this as spam, or alternatively you could set more headers so it doesn't look like fake email.

like image 149
Don Stewart Avatar answered Jan 26 '26 23:01

Don Stewart



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!