I understand that this kind of question bother you, and the people of this
group, but as I mention in my email, it does also bother people on the
stack. (This question will be seen and down-voted as duplicate.)

Since it’s a question about a Google product (Gmail API), the logical way
would be to post it in forum own by Google, since users seeking help are
under its responsibility. This Google group seems to be the only one
talking about Gmail api.

The reality is that Google escape from its responsibility by asking users
to use stack. But you seem to ignore that G*oogle doesn’t own stack*, and
that *stack has not been built to serve as Gmail api discussion**. Stack
has its own rules, you can’t ask such question (without losing points).


*So asking Gmail API user seeking for help to leave this group might clear
your conscience but that’s pretty much all it does.*
* Just another  example
<http://stackoverflow.com/questions/42541857/error-using-gmail-api-tuto-using-python-3-except-errors-httperror-error>:
I did struggle with several points from the code Google that causes an
error in python 3 (google don't update its code). I wanted to share one of
them on a stack, in order to help other users. It cost me some reputation
point for those —so I won’t do it again. (I then set my answer as "wiki",
to don’t lose more points)

ps: By the way if I deleted the question and posted it again in this group
it’s because I could not edit it, the topic was not accurate anymore and
misleading (Google should probably learn from what other company is doing,
like Microsoft

On Sat, Mar 4, 2017 at 12:17 AM, 'Alex Martelli' via Google App Engine <
google-appengine@googlegroups.com> wrote:

> I would recommend you post this code and question to stackoverflow.com --
> a very popular site regularly visited by many programming experts who like
> to answer technical questions (me included, when I have free time). You may
> want to just tag the question as python and email, since it's not really
> germane to google-app-engine (if you tagged it with the latter anyway, your
> question might be avoided by experts on python and email who are not also
> expert on App Engine).
>
>
> Alex
>
>
> On Fri, Mar 3, 2017 at 12:19 PM, Guillaume France <gc.com...@gmail.com>
> wrote:
>
>>
>> Thanks a lot Alex, you are right the from email import encoders was
>> missing. Now it sends the email but without the file attached to it.
>>
>> Any idea what could go wrong with this function? (I corrected other
>> things on it, it's the result of patchwork of code I took from several
>> places)
>>
>>
>> def create_message_with_attachment(sender, to, subject, msgHtml, msgPlain
>> ):
>>
>>  # Create message container - the correct MIME type is
>> multipart/alternative.
>>  msg = MIMEMultipart('alternative')
>>  msg['To'] = to
>>  msg['From'] = sender
>>  msg['Subject'] = subject
>>
>>  # Record the MIME types of both parts - text/plain and text/html
>>  part1 = MIMEText(msgPlain, 'plain')
>>  part2 = MIMEText(msgHtml, 'html')
>>
>>  # create .txt attachment
>>  filename=r"C:\Users\xxx\Desktop\test_Attachment.txt"
>>  fp=open(filename,'rb')
>>  att = email.mime.application.MIMEApplication(fp.read(),_subtype="txt")
>>  fp.close()
>>  att.add_header('Content-Disposition','attachment',filename=filename)
>>
>>
>>  # Attach parts into message container.
>>  msg.attach(att)
>>  msg.attach(part1)
>>  msg.attach(part2)
>>
>>  # raw = base64.urlsafe_b64encode(msg.as_bytes())
>>  raw= encoders.encode_base64(msg)
>>  raw = raw.decode()
>>  body = {'raw': raw}
>>  return body
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to google-appengine+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-appengine@googlegroups.com.
>> Visit this group at https://groups.google.com/group/google-appengine.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/google-appengine/3017717e-019f-47a8-96ce-4c45723e9d31%
>> 40googlegroups.com
>> <https://groups.google.com/d/msgid/google-appengine/3017717e-019f-47a8-96ce-4c45723e9d31%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Google App Engine" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/google-appengine/O94qnKnQu-k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at https://groups.google.com/group/google-appengine.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-appengine/CAE46Be-tAdEGj84ExamTXv5HOGptW-
> CanLpDxYy8t%3DnTgqmhVw%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-appengine/CAE46Be-tAdEGj84ExamTXv5HOGptW-CanLpDxYy8t%3DnTgqmhVw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CA%2BECagPy-nLc0kKpd5ugHJbEoVcmrW7YV_n3OXrkt4eaj_bSMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to