How to send validation email without going into the spam folder? - php

I have a PHP website that send a validation code when a new account is created.
My problem is since few months, a lot of those email goes in the spam folder.
I thought of a solution that is to use an "external service" to send my email instead of simply sending it via the mail function in PHP.
Question : 1) What external service should I use (I guess it would requires to have an API)?

Try using your ISP's or company's server as a relay. Use a sending address which exists, so that validation can be done on it, and bounces sent back to it. You may want to setup a separate domain for verification such as verification.example.com. You could then send the validation message from application#verification.example.com. Replace application and example as appropriate.
You may also want to look at https://serverfault.com/questions/241189/email-delivery-management-grievances#241260.

Have a look at this documentation from Google. It involves your network support including reverse lookup and Domain keys to be present. I think most of the email servers would have similar requisites.

Many times, when using the builtin mail function, the configuration isn't set up to help prevent this from happening. The reason is the Received header is set to an internal IP address, like 192.168.x.x which is used as an indicator to most spam filters. You may want to try finding a simple SMTP class that connects remotely so the headers get set properly.

Related

How to create email proxy server using php

I want to create a system, where an email is sent to me using smtp and i perform all the validation and some manipulations in HTML. and then send it using SMTP.
Currently i have some applications which are using SMTP as email sender, i want to create a simple layer in between them so that all the emails are sent from this filter, so that i can edit HTML source code and add some tracking links or check weather to send this email or not, depending on the spam and other filters.
This is a great PHP framework for sending emails, its supposedly very difficult to send emails from within PHP its self using the mail() function.
Are you trying to import an email sent from a specific address to you, extract data from that email and then forward the information on? Can we get an example of the email you are trying to extract/manipulate? I feel some more information on the task at hand would make this easier!
EDIT
So if understand correctly you want to program an application that all your other applications interface with and send emails from this new application?
If so there is lots of ways you could do this, I'm not aware of any github solutions (Correct me if I'm wrong) & I don't think any sort of SMTP service offers what you are asking (HTML changing being the big problem I'd imagine).
So what you could do is write an application with an API (referring which application sent the request, desired recipient, email template to use ETC) with all of your different settings/spam filter restrictions stored in database. You could then keep your emails all in a folder within the new application and when you amend them they get sent out.
Another solution would be to create a folder that contained all of the email templates, then create system links (securing X,Y&Z attack vectors) to your different PHP projects which depend on these email templates and do per application filtering (Spam/HTML Changes).

How does GitHub 'Reply by Email' work?

I notice that a lot of websites like Facebook and GitHub allow you to reply to an email notification which then posts the reply back to the application using a unique Reply-To address. How does this work on the back-end? I searched a lot but, only found that people were using unique Reply-To addresses. That's understandable but, what do they use to receive these emails? Do these companies set up email servers? I am trying to build this using PHP.
A common method is to set unique message ID's in the outgoing email and then looking at the In-Reply-To header to see which email this was in reply to. That lets you match up your server application's messaging system to emails. For example, if you send an email that represents a help desk ticket with ID 1234, the Message-ID could be something like
ticket-1234#myserver
Then, in email clients that work nicely (I'm looking at you Android), when you hit Reply, the reply has the header In-Reply-To: ticket-1234#mysever. You can go further by adding security tokens to ensure people can't forge messages (e.g. ticket-1234-hf29e9f2gf2e9fh29f#myserver). That security token is generated on the server when you send your first message and is then confirmed in the reply.
This normally works but can cause real headaches when email clients don't behave as they should!
This is how GitLab manages emails by using an identifier in the email address itself and catching it when the user replies. Although it is not relevant to any scripting language like PHP and uses server configs, this is what backend servers do to support reply by email functionality.
You have to set up a mail server to receive mail answers.
SIEVE filters on a IMAP server could be use to make some actions when a certain filter is detected.
But you can't only use PHP to make that type of system.

Send mail with external data through PHP

I looking into building a system that can read and send mails all by itself.
The mailserver already exists. All I want to do is fetch the e mail data with a php script running locally on the mailserver, store some of the data in an external database.
Then when an "event" is raised, I want to run a php script that get's some data out of the database, create a mail , and send it through the mail server.
I'm fairly new to this, so I hope the things I say make sense.
Here's my question: Is it secure enough to work this way?
Am I doing anything against "the rules" ?
Thanks
There is nothing wrong in doing the things this way. Its not against the rule. But Email Deliverability is not guaranteed because:
There is no guarantee that the email you send will pass the spam filters of email providers.
Number of emails you send to 1 user in a day, Any spam keyword in the mail content, user marking your email as spam etc.
Basically, there are n number of reasons why your mail server might get blacklisted by email providers.
To ensure Email Deliverability, you need to get your mail server IP whitelisted with all the email providers. (which is not easy)
I would suggest you to use bulk email sending third party solutions like Sendgrid, Madmimi, etc.
Refer: Discussion on choosing email sending service
Also, these services also gives statistics like open tracking, click tracking etc...

How can I get my mails from a pop-Server with php?

I am sending some mailings to a 5k list. I am not using any mailing commerce services. As expected I am getting some mails back from my mail-deamon and I would like to delete the those from the recipient-list. Is there a way to read the pop-mails programmatically?
is there maybe an easy and quick workaround?
A way to read POP mail via PHP: PHP: Download incoming email from POP3 or IMAP, parse it, and mark it as read/delete on server
(The code provided in the answer is using the functions suggested by Lèse majesté in its comment, but you find a ready to use small piece of working code thet does exacly what you need).
Obviously you will need to write also the code to programatically delete the address from your newsletter's DB.
I would use a cronjob (very easy to set on an hosting with cPanel) to programatically call the code that read the POP3 account and deletes the invalid addresses from DB.
A workaround? I don't know.
Can't you just set your "from" and "reply-to" address to an email address you can check? and then just check that email inbox to see what has bounced.

PHP - Send email from other domain without being spam!

this was ask over and over and still no good solution!
When someone sends an email using php and placing another domain in "from" it will end up in spam.
Solutions normally are:
- Use your "from" and place the domain you want in the "reply-to";
- Have your domain whitelisted by main mail services.
The 1st its not really a solution and I was never able to make 2nd, because its impossible to reach hotmail.com, yahoo.com, etc..
I see lots of sites today having the option to email article to someone from the user email. How can I achieve this?
Thx,
Telmo Cardoso
When someone sends an email using php
and placing another domain in "from"
it will end up in spam.
This is not neccessarily true.
Check which mail servers identify your message as spam. Also check with your hosting company for their preferred method to send out mail.
Try to be straightforward with your message. Offer the users a short textarea (with your default masage), which they can change and customize. Also give the possibility to enter real name of the participants with their e-mail addresses.
Just be senible and your messas will go thru.
Send the email from your webserver and add a reply-to header like you have mentioned.
Make sure you have SPF setup for your server to help get yourself into the gMail, Live Mail and Yahoo accounts.
A nice and cheap alternative is to send your emails via Amazon SES to avoid having to warm your own IPs etc.
I would go with the Amazon SES (or a similar service) and leave the worrying about getting the server setup right to the experts. Make ensuring deliverability someone elses problem.
This article is a nice starting point:
http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html
The problem is related to the header of the email. not neccessarily the 'from' address domain. Some spam filters (i.e. cox.net incoming spam filters) will perform a reverse lookup on the IP address that the email came from. If the domain name returned on the reverse lookup is not the domain name of the sending address. Then they will liekly mark it as spam.

Categories