Author Topic: Sending Gmail Attachments  (Read 2758 times)

0 Members and 1 Guest are viewing this topic.

Nodo

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 6
    • View Profile
Sending Gmail Attachments
« on: June 16, 2015, 10:51:46 AM »
Good day James,

My objective here is to send an e-mail with an attachment using a Gmail account.

I understand that to send an e-mail I am to set up my username and password in Options and then use SMTP actions. But then I am unable to send attachments with the e-mail. That is the first part of the problem.

The second part is, Gmail for almost a year now started using what they call "Modern Security Standards" which is their fancy way of saying that they now use oauth 2.0 authorization ". To solve this, we have to use Gmail api with oauth functions to get around it or if not possible then to configure the Gmail account enabling "Less Secure Apps" so that we can use SMTP with SSL/TLS.

I have been considering writing my own implementation of Gmail`s api with Gmail library for python. But I noticed Gmail actions in VC and it got me thinking that if VC is already using Gmail`s API for Gmail actions ("GetAllSummeries","GetAllTitles","GetCount", etc) then it would be much easier to implement this directly with more actions to enable sending an email.

My question is should I write my own code using Gmail`s API or should I wait for Gmail actions to have a "send" action with attachment ?

The reason why I am asking is because I know you already have a lot on your plate lately and I do not want to bother you with more  :).

 


jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Sending Gmail Attachments
« Reply #1 on: June 16, 2015, 12:18:37 PM »
Hi Nodo,

I recommend you try something like this: http://www.smtpinfo.com/

I have not tested it but it looks like it should do the trick.

Nothing that I have already implemented in VC for email is using any google apis.  The email sender is using some borrowed generic smtp code written in C# and the gmail reader is using their atom feed.  I will take a look to see if it is possible to add support for attachments when sending by smtp.

I am somewhat reluctant to get involved with Google apis because of the way they have pulled the rug out from under me in the past (e.g. with translate and calendar).  That is not to say that I won't ever consider doing it but the motivation is currently not very strong, especially when what we already have works fine for simple email stuff and there are alternatives available like the link I provided to send attachments, and we also have options using Python.

If you can come up with something more sophisticated using Python I am sure there are many that would appreciate it.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Sending Gmail Attachments
« Reply #2 on: June 16, 2015, 01:03:09 PM »
I have added support for sending attachments with the SMTP.Send action.

It will be included in the next release, but it might take a couple of weeks for me to release it.

Nodo

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 6
    • View Profile
Re: Sending Gmail Attachments
« Reply #3 on: June 16, 2015, 01:05:30 PM »
Hi James,

Thank you so much for the information and the link. I tried a couple of alternatives just like this one and I got one working after disabling "Modern Security Standards" configuration in my Gmail account.

I remember what Google did with their calendar and Translate and even Speech. One more reason to hate Google :).

I really do hate to bring this up but I have to mention that for all new Gmail accounts; the current SMTP will not work and will give back this message in the log (I do not know if the same applies for old accounts that never used SMTP before or not).
Quote
Action ERROR: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at

That is because the current SMTP uses SSL/TLS to communicate with Gmail and Gmail will block all third party authentications that do not use Oauth 2.0 unless "Less Secure Apps" is enabled in Gmail`s configurations.

I hope this helps other members running through that problem if they tried to send an e-mail using SMTP.

I will try to use Gmail`s python API and see what I can come up with.

Nodo

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 6
    • View Profile
Re: Sending Gmail Attachments
« Reply #4 on: June 16, 2015, 01:08:02 PM »
I have added support for sending attachments with the SMTP.Send action.

It will be included in the next release, but it might take a couple of weeks for me to release it.

Thank you so much for adding it. Totally appreciated.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Sending Gmail Attachments
« Reply #5 on: June 16, 2015, 01:59:26 PM »
I really do hate to bring this up but I have to mention that for all new Gmail accounts; the current SMTP will not work and will give back this message in the log (I do not know if the same applies for old accounts that never used SMTP before or not).
That is because the current SMTP uses SSL/TLS to communicate with Gmail and Gmail will block all third party authentications that do not use Oauth 2.0 unless "Less Secure Apps" is enabled in Gmail`s configurations.
Well I don't see a big problem here.  You have two options right?  Either choose the "Less Secure Apps" option, or use a different SMTP server, like the one that comes with your ISP.

https://support.google.com/accounts/answer/6010255?hl=en

Nodo

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 6
    • View Profile
Re: Sending Gmail Attachments
« Reply #6 on: June 16, 2015, 02:32:03 PM »
Exactly :).

I just thought to mention this to benefit others who might come across the same issue.

Thank you again for your help, James.