Author Topic: How can I use gmail.com as SMTP server?  (Read 1269 times)

Offline Plenz

  • Newbie
  • *
  • Posts: 3
How can I use gmail.com as SMTP server?
« on: June 28, 2022, 05:58:10 AM »
I have a web server for my website mydomain.de and for my e-mail address plenz@mydomain.de. How can I send outgoing e-mails by using smtp.gmail.com? I tried already, but the authentification failed.
As login, I have to set my complete gmail address: $config['smtp_user'] = 'plenz123456@gmail.com' - is there a backslash before @ necessary or not?
Must I install the plugin bartnv/twofactor_webauthn which is actually intended for FIDO? Or any other plugin?

Offline Plenz

  • Newbie
  • *
  • Posts: 3
Re: How can I use gmail.com as SMTP server?
« Reply #1 on: June 28, 2022, 12:51:01 PM »
OK, I figured it out so far: I generated a special password and now I am able to send e-mails. But the e-mails have my gmail address as sender instead of the address which I am really using:

----- E-Mail Header ----------------------------------------------------
Return-path: <mygmailaddress@gmail.com>
Received: from mail by mail.lenz-online.de with spam-scanned (Exim 4.92)
   (envelope-from <mygmailaddress@gmail.com>)
   id 1o6DXj-000C3x-86
   for test@test.de; Tue, 28 Jun 2022 17:54:23 +0200
Received: from mail-ed1-f41.google.com ([209.85.208.41])
   by mail.mydomain.de with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128)
   (Exim 4.92)
   (envelope-from <mygmailaddress@gmail.com>)
   id 1o6DXj-000C3s-5w
   for test@test.de; Tue, 28 Jun 2022 17:54:23 +0200
From: My Name <mygmailaddress@gmail.com>
X-Google-Original-From: My Name <myname@mydomain.de>

----- my RoundCube config -------------------------------------------------
$config['smtp_server'] = 'ssl://smtp.gmail.com';
$rcmail_config['mail_domain'] = 'mydomain.de';
$config['smtp_user'] = 'mygmailaddress@gmail.com';
$config['smtp_pass'] = 'abcdefghijklmnop';

Is there a way how to set "myname@mydomain.de" as sender?

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: How can I use gmail.com as SMTP server?
« Reply #2 on: June 28, 2022, 02:40:17 PM »
Please look at gmail documentation, google rewrote the heade,rs I'd guess as part of their anti-spam measures.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦