I'm trying to send email verification emails from an app I'm writing. I'm running on Linode using server = smtplib.SMTP() and server.sendmail(). For some reason, gmail is marking these messages as spam.
My mail template is:
{% if define('From', 'CQ <Invite#campusquery.com>') or define('Reply-To', 'noreply#campusquery.com') or define('Subject', "CQ: You've been invited to our beta!") %}{{fail()}}{% end %}
msg goes here
It also worked before when I made CQ be invite#campusquery.com instead. However, when this way does not allow me to define a sender.
How do I fix this?
Thanks.
What server are you sending from? There are tons of other factors involved like IP blacklists, rate of messages, whether users have marked you as spam, DNS/reverse DNS, SPF records.
You might consider signing up for an account with litmus.com to test your emails and see how you're performing on spam lists, and what you can do to improve it.
I would think that the "From" address would need to be a valid email address--e.g., have <some name>, an # and a valid host like in bob#example.com--in order for GMail to not consider it spam.
Related
In theory a domain is just a glorified IP address,
so if I take my public IP,
Ex. 12.34.56.78
then is there a way for me to send emails from the alias of noreply#12.34.56.78?
If so do I need to setup a custom email server?
I don't need to receive emails just send them.
Also if it won't work, how come?
TY
Yes, you can.
There is nothing preventing you from sending an email to (test#test.com) or (test#10.10.10.10) in theory. As long as the mail server accepts hostnames and IP addresses.
However, in reality, this just isn't the case.
For one, spam prevention has greatly increased in the past few years making most spam prevention software prevent these kinds of emails.
Secondly, some SMTP servers will not recognize or accept emails from these kinds of addresses.
In the end, these kinds of addresses are only really used in spam mail.
I have a local python file that I'm using to send emails through sendgrid's SMTP:
gmail_sender = "example#gmail.com"
server_username = "apikey"
server_password = prod.CONFIG['sendgrid_SMTP']
server = smtplib.SMTP_SSL('smtp.sendgrid.net', 465)
server.login(server_username, server_password)
email_information['From'] = gmail_sender
server.sendmail(email_information['From'], email_information['To'],
email_information.as_string())
I'm confused about who is sending the email. I replaced gmail_sender with multiple different emails, and without having to give the password to those emails, I could send an email through sendgrid's SMTP. In the from section of the email I sent, it says the email I put as the gmail_sender plus "via sendgrid.net." I can make it seem like anyone sent the email, isn't this a security concern?
Any guidance is appreciated :)
The alternative is rather daunting. You would have to technically prove to them that every address you want to send from is actually yours.
Some services require you to prove that a domain is yours by giving you a unique cookie and telling you to publish it in the domain's DNS records. If you have control over the DNS for a domain, you have the control over the domain. But there is no similar mechanism for email - you could simply forge the sender on the email which is supposed to prove that you own the address.
Anyway, going through this ordeal for every domain you want to use is already a chore. Imagine what it would mean for clients who want to use dozens, hundreds, or even thousands of different sender addresses.
The Sendgrid terms of service have some general language about network abuse, which probably apply to using somebody else's email address. I could find nothing specific about address forgery in their ToS. Having a legal restriction in a contract (and enforcing it!) relieves them from the need to implement a technical restriction.
I'm actually aware that I can get the address which the email is sent from, but I wonder if I can get the user name of de sender too. I searched on the email module documentation but I didn't find anything about it.
Short answer: no, you can't.
Username of the sender remains between the SMTP server and the sender; it's never included in the data sent outside, unless the sender explicitly typed it into the email text. Note that there can be several hops between the originating SMTP server and the receiving SMTP server.
IMAP servers are used to access received mail; they have no idea how it was sent.
I've checked so many articles, but can't find one for server to server email receiving. I want to write a program or some code just acts as an email receiver, not SMTP server or something else.
Let's suppose I have a domain named example.com, and a gmail user user#gmail.com sends me an email to admin#example.com, or a yahoo user user#yahoo.com sends me an email to test#example.com. Now, what do I do to receive this email? I prefer to write this code in Python or Perl.
Regards,
David
http://docs.python.org/library/smtpd.html
http://www.doughellmann.com/PyMOTW/smtpd/
In Perl:
Net::SMTP libraries (including Net::SMTP::Server).
Here's an example of using it: http://wiki.nil.com/Simple_SMTP_server_in_PERL
"reveive" is not a word. I'm really not sure if you mean "receive" or "retrieve".
If you mean "receive" then you probably do want an SMTP server, despite your claim. An SMTP server running on a computer is responsible for listening for network requests from other SMTP servers that wish to deliver mail to that computer.
The SMTP server then, typically, deposits the mail in a directory where it can be read by the recipient. They can usually be configured (often in combination with tools such as Procmail) to do stuff to incoming email (such as pass it to a program for manipulation along the way, this allows you to avoid having to write a full blown SMTP server in order to capture some emails).
If, on the other hand, you mean "retrieve", then you are probably looking to find a library that will let your program act as an IMAP or POP client. These protocols are used to allow remote access to a mailbox.
Good article at http://muffinresearch.co.uk/archives/2010/10/15/fake-smtp-server-with-python/ showing how to subclass smtpd.SMTPserver and how to run it.
I'm reading this article : http://code.google.com/intl/zh-CN/appengine/docs/python/mail/receivingmail.html
I'd like to know, is this the right article to read to deal with mail from others sent to me ?
My Gmail is zjm1126#gmail.com, so when someone sends email to zjm1126#gmail.com, can I do something automatically with the incoming mail?
Update:
The article say:
Your app can receive email at addresses of the following form:
string#appid.appspotmail.com
Where do I set this?
is article used to deal with mail from others send to me ?
Yes
and my gmail is zjm1126#gmail.com , so someone send email to zjm1126#gmail.com,i can do something automatically use incoming mail ,yes ?
No (unless you configure GMail to forward it to the address the article tells you to use)
where to set this ???
Nowhere. You are given your appid when you sign up.