Jump to content

Recommended Posts

I need to send an email to my users once they register telling them that we have received their registration and are processing it, but what happens is that email goes to spam. It doesn't do it with Gmail though, but I think that's because my email is hosted through them. Anyway, this is my code:

 

<?php

$to = $_POST['email'];
$subject = "Your application at Virtual American Airlines";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "From: Virtual American Applications <newpilot@virtualamerican.org>\n";

{mail($to, $subject, "My message.. ", $headers); include "join4.php";}

 

Any ideas on how to stop it from going to spam? I asked my Web hosting and they said that it's likely that someone on the server that I'm on has spammed and the IP is blocked, is there still any way around this? Thanks!

Link to comment
https://forums.phpfreaks.com/topic/240116-php-mail-goes-straight-to-spam-folder/
Share on other sites

I asked my Web hosting and they said that it's likely that someone on the server that I'm on has spammed and the IP is blocked, is there still any way around this? Thanks!

 

Yup, find a different host.

 

Alternatively there are a few options regarding email delivery companies (can't think of a better way to word that). You basically pay a small rate and they make sure your emails are delivered.

Mail seen as spam is most often due to not setting specific headers.  Try adding these:

 

$headers .= "Reply-To: Virtual American Applications <newpilot@virtualamerican.org>\n";
$headers .= "Return-Path: Virtual American Applications <newpilot@virtualamerican.org>\n";
$headers .= "X-Mailer: PHP". phpversion() ."\n";

 

If you still have a problem, try adding this to your mail() call:

 

mail($to, $subject, "My message.. ", $headers, "-f newpilot@virtualamerican.org");

 

Sorting headers has solved this kind of problem for me in the past.  8)

 

Slightly off topic from the actual coding side of the above, but is it true that having 'flown' for a virtual airline during training, a qualified pilot has an advantage when applying for a real airline flight crew position over others?

No. Not really, that'd would be very interesting though! But really, a virtual airline is solely put together by flight simulation enthusiasts and legally, are in NO way affiliated with any airline. If we say we are, then we would have to go through this whole legal process and probably just end up getting shut down in the end. It wouldn't be fun. Flying on a simulator on a desktop and flying a mechanical piece of metal are two COMPLETELY different things. That's one of the things that real pilots get angry over as us flight simulator enthusiasts like to say (well, not me because I understand that in no way are they the same) that they know everything there is about airplanes when in reality, they can't even fly one. I'm sure that you could add to your resume that you have flown virtually on a simulator at home for years, but I'm not sure how far it would get you.

The separator characters between each header statement should be "\r\n".

 

Does that From: email address actually exist on the sending mail server?

 

Assuming that the domain name being used in the From: email address is actually hosted somewhere different from where the sending mail server is at, do you have an SPF record at the name server where your site is being hosted at that indicates that the actual sending mail server is authorized to send email for your domain name? See this link - http://www.openspf.org/

Edit to the above: No matter where your web site and email server are hosted at relative to each other, you need an SPF record that indicates that the actual sending mail server is authorized to send email for the domain in the From: address.

 

The receiving mail servers at most of the major ISP's check for a valid SPF record and that it matches up the domain in the from address with the sending mail server and vote email as spam when it does not find an SPF record (they usually discard an email when the SPF record exists but doesn't match the sending mail server.)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.