Failed Gmail SPF check when importing mail through IMAP from our mailbox when original email was sent with ESMTP headers

Solution 1:

[...]
we import that mail in Gmail like any other emails from our boxes
[...]

That's wrong, as the mail headers tell as something different:

Received: from server.webvizarts.com  (server.webvizarts.com . [188.40.153.39])
    by mx.google.com with ESMTPS id ge6si41332059wjd.24.2015.02.19.06.26.03
    for <[email protected]>
    (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
    Thu, 19 Feb 2015 06:26:04 -0800 (PST)

The Emails are forwared by server.webvizarts.com to mx.google.com for [email protected]. Apparently without setting the envelope-from:

Authentication-Results: mx.google.com;
   spf=fail (google.com: domain of [email protected] does not designate 188.40.153.39 as permitted sender) [email protected]

Evidently the envelope's from is still [email protected].

I can think of three options you have here:

  1. Rewrite the envelope-from using the Sender Rewriting Scheme for example with postfix-srsd.
  2. Before sending/relaying, authenticate at gmail
  3. Push the email to Gmail's IMAP/POP3 mailboxes from your server or let them pull from your server by Gmail (I don't know which is easier)