I'd like to implement a way to check an outgoing email in django if it has a high spam score by way of clicking a button to read the email contents. This way, I could modify the email to be less than the spamassassin score of 5 or 10 (something like aweber's implementation) prior to sending it to my contacts.
Any help or pointers is greatly appreciated.
Related
Currently I am using Python and Exchangelib module to build a macro that shows emails that haven't been replied.
Background for the macro:
A support group of 3 peoples get daily lot of emails from customers to "support#abc.com".
One of 3 peoples will reply back using the same email "support#abc.com" as sender.
Due to high amount of daily inbox and the fact that 3 peoples share the same email "support#abc.com" to respond, human error happens from time to time and therefore some emails stay unreplied.
What I would like to try is to use the following symbol as the sign if the email is replied.
I could not figure out what the attribute for that is called.
I have compared all attributes for the second and the third emails side by side. I was expecting that the second email has a certain boolean attribute X with value "True" while the third email "False" (or vice versa):
Does such a boolean attribute exist? If no, how could my web browser show the symbol on my first screenshot?
If it does not exist, how would you solve it?
Another alternative to solve it would involve any "support#abc.com"-reply would need to be sent not only to the customer but also to "support#abc.com" itself as CC or normal recipient.
After that I just need to read the attribute "conversation_id" and compare it to other earlier emails.
I don't like the alternative because of the CC, it would create a new element in "the solution" that is prone to human error.
Any inputs would be welcome.
Thank you in advance.
I don't know of any fields on the Message object in EWS that tells you directly whether that message has a reply.
I think your best bet is to use the conversation_id of the message and check your Sent folder for that conversation_id. I believe that's what OWA does - messages where only one message is known with that conversation ID will not get the "replied" icon.
Im trying to send a simple email to do the password recover of a user, the input is just a email to send the new password..
But i can't... i get this error
SMTPServerDisconnected: please run connect() first
I already tried a few examples, like, https://bitbucket.org/andialbrecht/appengine_emailbackends/overview, but i get the same error
I really need this, maybe someone can tell me how to use an alternative to code in my view to send an email...Also i changed the backend to
EMAIL_BACKEND = 'djangoappengine.mail.EmailBackend'
but nothing,i don't know how to use this backend anyway :(
Plz Help :(
maybe someone can tell me how to use an alternative to code in my view to send an email...
I can help with this, seeing as it seems that perhaps this repository you're trying to use is based on an earlier version of App Engine and is throwing the error due to a required code change somewhere in the library - either that or the fact that you changed the string from what the library recommends (your version: 'djangoappengine.mail.EmailBackend') to a string that seems to not be correct, as it's different to what the author of the repository directed you to use (their version: 'appengine_emailbackend.EmailBackend'), and this is causing trouble.
Whenever possible, I'd recommend seeing if there is an "app-engine-y" way to do something, before going to a third-party library or deploying a module somebody else wrote to hack in third-party capabilities, or looking for an advanced/experimental feature (for example, use Datastore first, rather than remotely connecting to a MySQL VM, unless you need MySQL). If you absolutely need that library, this is a different story, but if you just want to send emails, the Mail API is what you need. It's a convenient way to send emails on App Engine.
I'm going to assume in the following that you are storing your user's usernames and hashed passwords in custom-defined User-kind entities in your Datastore. If you have your users using simple OAuth to sign into your site, there is never any reason to "reset/recover password":
Create the <form action="/some/route" action="POST"> element on
the page where the user requests password recovery.
Put the code responsible for handling this form submission (they will input their email, or whatever account info they need for your code to find their User entity in the Datastore in a handler that will respond on that route.
In the handler, generate a unique token and store it in the Datastore. Send the token in the email that you generate and send using the Mail API (see the example code in the link to the docs I provided). This will allow your user to return to your site, authenticate with the token from the email, and then fill out a form to create a new password. You will then hash this password (with a salt) and store it in their User entity in your Datastore.
I'm skipping over the details of how to implement a "password recovery form", given what I said about OAuth and that you are probably really only concerned with how to send mail. In the email you send, for example, you can insert a hyperlink to your site with the token already inserted as a query param, so that the user doesn't have to copy and paste, etc.
So I'd like to preface this with the fact that I am NOT a programmer. I know a little Python, but that's about it.
So this is what I'm trying to do:
User fills out a Google Form and the responses are dumped into a spreadsheet. As a part of the form, their email address is captured in "'Form Responses'B:B"
Not sure if this is even possible, but I'd like to know:
for row X If column P = yes and column c = Accept and column F = Yes
Capture email from Column B and add them to GoogleGroup and send Welcome_Email
Please help! :)
Thanks in advance.
Google Apps Script is JavaScript.
When you build the form in Google Forms, set the Data Validation for the email field to require email address. That way you don't have to hassle with validating it yourself.
http://googledrive.blogspot.com/2013/09/four-new-ways-to-customize-your-google.html
Once the form is built, go to Tools, Script Editor, and make a new Blank Project.
Replace any code in there with this:
function addToGroup(e){
var itemResponses = e.response.getItemResponses();
var emailAddress = itemResponses[#].getResponse();
var group = GroupsManager.getGroup("group name").addMember(emailAddress);
GmailApp.sendEmail(emailaddress, "Welcome to Group Name!", "You have been successfully added to Group Name");
}
https://developers.google.com/apps-script/reference/gmail/gmail-app#sendEmail(String,String,String)
Replace # with the zero-indexed number of the column containing the email addresses, and group name is the mailbox name of the group on your Google Apps domain.
Then you just need to send the welcome email.
Save the project, and go to Resources> Current Script's Triggers. Set it run the addToGroup script on FormSubmit, Authorize it when prompted, and that should be it for you.
https://developers.google.com/apps-script/reference/domain/groups-manager
http://support.google.com/a/bin/answer.py?hl=en&answer=60757
This only works with Google Apps accounts, and only if you have the Provisioning API turned on in your domain admin console. If you're using a standard consumer Google account, they don't have anything available to do this.
Doing a few searches on this forum on words like email or groups you'll find quite a few scripts and if you spend a couple of hours looking at how they are built you'll be able to write something that does what you want...
If at that moment you meet some unexpected difficulties you'll be welcome to ask for help if you show what you've done.
I'm doing a bit of an experiment in Python. I'm making a script which checks a rss-feed for new items, and then sends the title and link of the items via email. I've got the script to work to a certain level: when it runs it will take the link+title of the newest item and email it, regardless of wether it emailed that file already or not. I'd need to add 2 things: a way to get multiple items at once (and email those, one by one), and a way to check wether they have been sent already. How would I do this? I'm using feedparser, this is what I've got so far:
d = feedparser.parse('http://feedparser.org/docs/examples/rss20.xml')
link = d.entries[0].link
title = d.entries[0].title
And then a couple of lines which send an email with "link" and "title" in there. I know I'd need to use the Etag, but haven't been able to work out how, and how would I send the emails 1 by 1?
for the feed parsing part, you could consider following the advise given in this question regarding How to detect changed and new items in an RSS feed?. Basically, you could hash the contents of each entry and use that as an id.
For instance, on the first run of your program it will calculate the hash of each entry, store that hash, and send these new entries by mail. On it's next run, it will rehash each entry's content and compare those hashes with the ones found before (you should use some sort of database for this, or at least an on memory dictionary/list when developing with the entries already parsed and sent). If your program finds hashes that where not generated on the previous runs, it will assemble a new email and send it with the "new" entries.
As for your email assembling part, the question Sending HTML email in Python could help. Just make sure to send a text only and a html version.
For the simplest method see the python smtplib documentation example. (I won't repeat the code here.) It's all you need for basic email sending.
For nicer/more complicated email content also look into python's email module, of course.
I have a user input form here:
http://www.7bks.com/create (Google login required)
When you first create a list you are asked to create a public username. Unfortuantely currently there is no constraint to make this unique. I'm working on the code to enforce unique usernames at the moment and would like to know the best way to do it.
Tech details: appengine, python, webapp framework
What I'm planning is something like this:
first the /create form posts the data to /inputlist/ (this is the same as currently happens)
/inputlist/ queries the datastore for the given username. If it already exists then redirect back to /create
display the /create page with all the info previously but with an additional error message of "this username is already taken"
My question is:
Is this the best way of handling server side validation?
What's the best way of storing the list details while I verify and modify the username?
As I see it I have 3 options to store the list details but I'm not sure which is "best":
Store the list details in the session cookie (I am using GAEsessions for cookies)
Define a separate POST class for /create and post the list data back from /inputlist/ to the /create page (currently /create only has a GET class)
Store the list in the datastore, even though the username is non-unique.
Thank you very much for your help :)
I'm pretty new to python and coding in general so if I've missed something obvious my apologies.
Tom
PS - I'm sure I can eventually figure it out but I can't find any documentation on POSTing data using the webapp appengine framework which I'd need in order to do solution 2 above :s maybe you could point me in the right direction for that too? Thanks!
PPS - It's a little out of date now but you can see roughly how the /create and /inputlist/ code works at the moment here: 7bks.com Gist
I would use Ajax to do an initial validation. For example as soon as the user name input box loses focus I would in the background send a question to the server asking if the user name is free, and clearly signal the result of that to the user.
Having form validation done through ajax is a real user experience delight for the user if done correctly.
Of course before any of the data was saved I would definitely redo the validation server side to avoid request spoofing.
jQuery has a nice form validation plugin if you are interested. http://docs.jquery.com/Plugins/validation.
In my career, I've never gotten around having to validate server side as well as client side though.
About the storing of the list (before you persist it to the datastore). If you use ajax to validate the user name you could keep the other fields disabled until a valid user name is filled in. Don't allow the form to be posted with an invalid user name!
That would perhaps solve your problem for most cases. There is the remote possibility that someone else steals the user name while your first user is still filling in his list of books. If you want to solve that problem I suggest simply displaying the list as you got it from the request from the user. He just sent it to you, you don't have to save it anywhere else.
Can you use the django form validation functionality (which I think should just abstract all this away from you):
http://code.google.com/appengine/articles/djangoforms.html
Search in that page for "adding an item" - it handles errors automatically (which I think could include non-unique username).
Warning: also a beginner... :)