I am using fetchmail and procmail to forward email to a gmail account. I am using Mac Terminal.

Here is my .fetchmailrc:

set no bouncemail
poll outlook.office365.com with protocol imap
port 993
auth password
user [email protected] password password
sslfingerprint "<Correct Fingerprint - not sure if I should copy this here>"
sslcertpath /Users/myuser/.certs
no rewrite
mda "/usr/local/bin/procmail -f %F -d %T";

and here is my .procmailrc file:

! [email protected]

When I run fetchmail -vv everything seems to work fine, it finds the one unread email in the email account I am fetching from. And the last thing in the output under procmail is:

procmail: Executing "/usr/sbin/sendmail,-oi,[email protected]"

No apparent errors are listed.

However, nothing is showing up in my gmail account?

  • 2
    If I read correctly, you are using a Mac. I seem to recall that it is necessary to do some configuration in order to use sendmail. Perhaps benjaminrojas.net/… will provide some information.
    – KevinO
    Commented Jun 7, 2017 at 21:05
  • 1
    You should see the unsent/queued messages by executing sudo postqueue -p. If you're at work, it may be easier to configure Postfix to use an internal relayhost/smart-host. You would not need to set the SASL connection as noted in the link from @KevinO comment if that is the case.
    – Deathgrip
    Commented Jun 7, 2017 at 22:00
  • Is there a reason you want to run this on your own computer? It would make more sense to configure this directly in Gmail. My understanding is that they support this. See e.g. support.google.com/mail/answer/21289
    – tripleee
    Commented Jun 8, 2017 at 7:01
  • @tripleee - unfortunately Gmail can only fetch via POP and my work email only allows IMAP fetching and will not do automatic forwarding, hence this complicated work around.
    – Amanda
    Commented Jun 8, 2017 at 12:23
  • Thanks for the other comments, if the below by @thrig does not work I will look into the configuring link and/or internal relayhost, Thanks for taking the time
    – Amanda
    Commented Jun 8, 2017 at 12:25

2 Answers 2


Does it have to be procmail and the Apple mail transport agent, or could you instead lob things over to ssmtp? E.g. with MacPorts (install details will likely be very similar under Fink and Homebrew)

$ sudo port install ssmtp

And then configure ssmtp via /opt/local/etc/ssmtp/ssmtp.conf (or wherever Fink or Homebrew hide that file) with something like

[email protected]
[email protected]

And then setup your fetchmailrc with something like

mda "/opt/local/sbin/ssmtp FIXME"

This if all goes well should cause fetchmail to deliver to ssmtp and that to gmail.

  • Will try this ASAP, doesn't NEED to be procmail, that's just what I had found by searching.
    – Amanda
    Commented Jun 8, 2017 at 12:24
  • So this definitely "worked", though maybe not in the way I hoped. And that is definitely my fault for not being clear from the get go. If one IS able to get gmail to fetch mail, then when the mail comes in you see it as coming from "[email protected]". However, with this process the email comes from me, [email protected], rather than the original sender. I apologize for taxing your time further, particularly if it is not possible, but do you know if what I am asking for is possible with this set up (maybe it wasn't with procmail either...)
    – Amanda
    Commented Jun 8, 2017 at 19:31
  • Changing FromLineOverride=yes gets half way there, now the email appears to come from SENDER NAME <[email protected]> rather than FIX ME <[email protected]>. But still not quite what I was hoping.
    – Amanda
    Commented Jun 8, 2017 at 19:58
  • Try also removing the root= line as the ssmtp.conf.sample configuration indicates the presence of that causes rewriting, which my config has as I'm lobbing different things as if from me through gmail.
    – thrig
    Commented Jun 8, 2017 at 20:11
  • Apologies for slow replies, have been at this most of the morning again. This did not work. I also tried to abandon ssmtp and go back to procmail following the comments above - I was able to configure sendmail appropriately but actually the result was the same - mail came to gmail as if from ME rather than from original sender. Maybe this is just not fixable, but it feels like people are able to redirect email so it should be doable. Happy for solutions using either procmail or ssmtp. I will keep looking around though if anyone has suggestions I am all ears.
    – Amanda
    Commented Jun 9, 2017 at 14:44

For future reference, both the comment from @KevinO and the answer from @thrig worked in that emails are now showing up in my gmail (albeit they look like they come from [email protected] rather than original sender, but that is another problem).

For those wanting to use procmail/postfix - As an update, to configure sendmail to send from gmail on OSX Sierra the instructions are a little different than the link that @KevinO provided:

Edit file /etc/postfix/main.cf, add to the bottom:

mydomain_fallback = localhost
mail_owner = _postfix
setgid_group = _postdrop
relayhost = smtp.gmail.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
#smtp_tls_security_level = encrypt
#tls_random_source = dev:/dev/urandom
smtp_sasl_mechanism_filter = login
smtp_sasl_mechanism_filter = login

in sasl_passwd:

smtp.gmail.com:587 [email protected]:password

to test set-up:

date | mail -s test [email protected]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .