I am running Django on Python SDK of GAE.
My application is an order processing app for a small business. I want to email a delivery note in the form of a spreadsheet to customers on completion of an order. Now I have been reading the docs and its no problem sending attachments, just that only certain file types are allowed in GAE.
I have created a spreadsheet document using the Google Data API, but my problem is how to get the Google Spreadsheet document emailed to the customer. My App Engine is on a hosted domain, so normal gmail accounts don't have access to it and many of the customer email accounts won't even be gmail anyway, the Google Spreadsheet attachment will just be a XML Atom object pointing to a doc hosted on my account which won't be accessible to outside users anyhow, right?
Is there any way to copy this Spreadsheet object and attach it to the email, so it can be opened locally by users with no access rights to my google doc, it can basically be opened offline. My code looks like this:
new_entry = gdata.GDataEntry()
new_entry.title = gdata.atom.Title(text='Delivery Note from ' + company.company_name)
category = gd_client._MakeKindCategory(gdata.docs.service.SPREADSHEET_LABEL)
new_entry.category.append(category)
doc_entry = gd_client.Post(new_entry, '/feeds/documents/private/full')
.....now build the spreadsheet
doc_title = 'deliverynote' + '.' + doc_entry.title.type
.....build the email body
mail.send_mail(sender_address, to_address, subject, body, attachments=[(doc_title, str(doc_entry))])
Doing it this way however when the customer receives the mail, when they try and open it they get an unexpected error (the exact words that Google uses when it tries and opens it).
The other alternative of course is to try and convert it to an Excel file. Methods are provided by google to export the file as an excel file to the local file system, but then the program is faced with the problem of uploading it again without any manual user intervention. Besides the excel file type isn't supported by GAE as a legitimate attachment type.
Has anyone got any ideas?
Interesting question.
Since you use GData to create it, your GAE app should have rights to get a copy of it and attach it. Not sure what format it would be in, and how the guy that receives it uses it though.
If you attached a Google spreadsheet to an email, how would the person open it? Since Google runs "on the web"? I know Google now has an offline option, but I haven't tried it yet. I think it requires install Google Gears and other stuff on the local machine.
Do you want people to share the spreadsheet or each get their own copy? Could you just change the rights to let more people have read-only or update access?
Do all your recipients have Excel? Do they all have Google App Accounts?
Neal Walters
Related
I recently configured Service Cloud for my organization and for the most part it is working great. We do have an issue I can seem to solve though. The first time an internal employee submits a case (email-to-case), there is not a contact record to associate with the case, so the help desk must spend time creating a contact record for the employee before they can proceed with resolving the case. Is there a way to automate or sync with Office 365 to create a contact record for each employee?
I have considered and/tested the options below, but none do what I want:
I have already set up and tested Einstein Activity Capture. This is a great tool but will not sync internal (same email domain) contacts into Salesforce.
I know I can automate an export from Office 365 into an AWS S3 Bucket and then use AWS AppFlow to create/update contact records. This one is feasible, but I have to imaging there is a way to integrate the two platforms without exporting data into a staging area.
I can't use anything that requires manual intervention, like Data Loader.
I'm developing a tool that lets an user receive some data through an email account, in the form of a regular file. The goal is to implement this:
file → email attachment → canbeanything#myapp.com → system backend copies attachment.
Can I use Google's App Engine to develop this application? I have read their documentation on handling email but I think it's bound to just the admin's account. Can you explain me the process for achieving this?
App Engine application can receive emails to a specific list of address. If my-app-id is your application then any email ending with #my-app-id.appspotmail.com will be sent to your application.
For example the following emails are valid destinations that will be received by your app :
hello#my-app-id.appspotmail.com
no-reply#my-app-id.appspotmail.com
...
Note that even if you app has a custom domain like myapp.com, the destination email address will remain in #my-app-id.appspotmail.com. You can probably circumvent this by configuring your domain's email settings to forward all emails to App Engine.
Once received by the App Engine infrastructure, the emails are POSTed to a specific URL of your app, where you can write a handler (a Servlet in Java) to process the email content and save it somewhere. Here is the Python documentation on receiving email, and the Java documentation.
Note that there probably is a limit to the size of attachments you can receive this way. I expect something along the line of 25Mo, which is GMail's attachment limit or 32Mo which is App Engine's POST request size limit.
Once you receive an email, I strongly recommend you perform the processing in a task queue, to avoid temporary issues (out of memory, faulty process) that would lead to the email being lost.
When it comes to saving the attachment, consider using Google Cloud Storage, since the Datastore is limited to 1Mb per entity.
I am writing an travel itinerary app engine application which will interact with the calendars of my users. In order to manage access to my user's calendar I intend to use OAuth 2.0. I looked online for various code examples and the closest to what I am trying to acheive is (http://code.google.com/p/google-api-java-client/source/browse/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/server/?repo=samples). I have the following questions
1) I find that the server needs access to the application's client id and client secrets. Most of the sample code I have seen so far loads this from a local file. Does AppEngine give some API which will enable me to retrieve the client id and client secret without me having to worry about storing it ?
2) If I have to store the client secret in a secure fashion what are my options ?
3) What is the best way to store a user's access token and refresh token ?
It almost never changes, so hardcode it. It's only really loaded from a file in the sample programs so that you can get the samples running without touching the code.
See 1.
You can use the Google provided Credential class which uses a dedicated kind. Or, given that they are simply strings, you can store them as part of the User kind which your app almost certainly has to track your registered users.
As a tip, separate writing your oauth code from writing your calendar code. I would start by writing an app that only authorises, stores the refresh token, and refreshes the access token. You can test your access token using curl. Once you have that all working, then add your Calendar functionality as phase 2.
I want to create a google app that will let you add a file from a cloud service as an attachment to an email. From reading the google documentations it seems like you can't do anything while the user is creating an email, but the attachments.me app is able to do it. When composing an email, their app will pop up a button next to the regular attachment app letting you select an attachment from the cloud. I am new to working with google apps and I do not understand how attachments.me is able to do this. If anyone has an idea as to how this is possible please let me know, thanks.
To add features to the GMail UI you'd probably have to implement this as a Chrome extension (and/or Firefox or IE extension to support those browsers). In fact, this is apparently how attachments.me does it.
What the extension does is load when you go to gmail.com, identify a place in the UI where it wants to add its button(s), and inject them using JavaScript. You may then want to use JavaScript again to do something like add a link to the text of the email before it gets sent to the media you want to attach from the cloud, or intercept the "Send" button to tell your server to send the message with the cloud attachment included (assuming the user has authorized your server to send as them -- this can have serious security implications)
Beware, modifying complex web app UIs like GMail's using a Chrome extension can be very difficult; GMail may make changes that break your UI or functionality, and they may do it whenever they want, or only to a subset of users, so you'll have to constantly keep up with these changes to fix bugs. All in all I don't recommend it as a way of adding attachments to emails.
My data files include a demo version of my program as long as a complete, unlocked one. Google App Engine is used to serve webpages to the user. A database records whether the users have purchased a product, and based on that, I’d like to serve them file A-demo.exe or A-completeVersion.exe
I thought about calling self.redirect( A-completeVersion.exe ) according to the purchase flag, but that would let the user see the URL of the complete version in his browser.
Is there something I could do to proceed with this download without the URI appearing in clear?
PS: by the way, I’m using the Python 2.7 version.
If you're requiring the users to log in, serve the "full" version from the blobstore. That would allow you to easily check that they've got a valid license before downloading the file.
If you're not requiring login, you could generate single use URLs that you serve the application from. Once they have completed the purchase, generate a uuid and write an entity to the datastore with that uuid as the key. When they try to download, check and see if that key is valid. If it is, update the entity to reflect that it was used and then send the blob.