100% Delivery Guaranteed Email

Good Day,

How do you make sure email you send programmatically is not automatically marked as spam or not delivery to the user?

Can you please guide me on the steps to make use of it in coding and server level.

Language: PHP
Server : CentOS
Email: Gmail server.

Best Wishes,
Siva Kumar S.
Who is Participating?
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
Here is my PHP Email demo.  Although you may not need the javascript validation, you should provide proper headers as shown because some mail servers will reject email that is not properly formed.  Save this as "Email.php" and it will post to itself.  Put in your own email address for '$toText' on about line 20 and you can send yourself an email.

# some settings of POST vars
if (!isset($_POST['submit']))  $submit = ''; else $submit = $_POST['submit'];
if (!isset($_POST['subjectText'])) $subjectText = ''; else $subjectText = $_POST['subjectText'];
if (!isset($_POST['msgText'])) $msgText = ''; else $msgText = $_POST['msgText'];
if (!isset($_POST['ccText'])) $ccText = ''; else $ccText = $_POST['ccText'];
if (!isset($_POST['bccText'])) $bccText = ''; else $bccText = $_POST['bccText'];
if (!isset($_POST['nameText'])) $nameText = ''; else $nameText = $_POST['nameText'];
if (!isset($_POST['fromText'])) $fromText = ''; else $fromText = $_POST['fromText'];

if ($submit == "") {
    $title="Test Email Page";
else {
	if($fromText === "") die("No name!");
	$title="Test Email Page";
  $announce="Your Message has been Sent!";
	$header = "From: ".$fromText."\r\n";
//	$header .= "Cc: ".$ccText."\n";
	$header .= "Reply-To : ".$fromText."\r\n";
	$header .= "Return-Path : ".$fromText."\r\n";
	$header .= "X-Mailer: PHP\r\n";
	$header .= "MIME-Version: 1.0\r\n";
	$header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
//	ini_set(sendmail_from,$fromText);  
	mail($toText, $subjectText, $msgText, $header, '-f'.$fromText);
//	ini_restore(sendmail_from);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo($title)?></title>
<style type="text/css">
A:link { color: #999999; }
A:visited { color: #999999; }
A:hover {color: #0099ff;}
<script type="text/javascript">
function check()
var at=document.getElementById("fromText").value.indexOf("@");
var eml=document.getElementById("fromText").value;
var nam=document.getElementById("nameText").value;
var alerttxt="";
var submitOK="true";

if (eml.length < 5 || at == -1)
    alerttxt=alerttxt+"Please enter a valid e-mail address!\r\n";
    //return false;
if (nam.length < 3)
    alerttxt=alerttxt+"Please enter your name.\r\n";
    //return false;
if (submitOK=="false")
    return false;

// -->

<body bgcolor="#ddeedd">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" summary="" width="580">
<tr><td align="center">

if ($submit != "") {
   	echo ("To: ".$toText."<br>\r\nSubject: ".$subjectText."<br>\r\n".$msgText."<br>\r\n".$header);

<p><b><font color="#000000" size="5">Test Email</font></b></p>
<font size="4" color="#000000">

<form method="POST" action="Email.php" onsubmit="return check();">
    <p><font size="3"><b>Name: <input type="text" name="nameText" id="nameText" size="46"></b></font></p>
    <p><font size="3"><b>Email: <input type="text" name="fromText" id="fromText" size="46"></b></font></p>
    <input type="hidden" name="subjectText" value="Web Mail">
    <p><font face="Arial" size="3"><b>Message Text:</b></font></p>
    <p><font face="Arial" size="3"><b><textarea rows="6" name="msgText" cols="60"></textarea></b></font></p>
    <p><font size="3"><b><input type="submit" value="submit" name="submit" style="font-family: Arial; font-size: 12pt; font-weight: bold"></b></font></p>
    <input type="hidden" name="state" value="1">
  <b><font face="Arial" size="4" color="#e00000"><?php echo($announce)?></font></b><br><br>



Open in new window

Dave BaldwinFixer of ProblemsCommented:
What you want is not possible, you can not guarantee 100% delivery.  The receiver of the email can mark it as spam or reject it anytime they want, it is Not under your control.  The legal definition of 'spam' in the US is 'unwanted email' that is sent without permission or a previous business relationship.

In addition, some mails servers like Yahoo and Live/Hotmail may refuse to accept your email based on the fact that you do not have a 'reputation' with them.  Some mail servers refuse email until you ask and get permission to send to them.
rapidsivaAuthor Commented:
Good Day,

Thanks for the reply,

What is the best way to handle this.

We have our user registration in our website. once the registation is over they will get confirmation email to activate the account.

In this case how to handle to make sure the email is delivery and user activate the account.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Dave BaldwinFixer of ProblemsCommented:
The best thing to do is send a plain text email with the information they need.  Other things you should probably do is make sure you are sending from a valid email address since some servers will check that.  It needs to be one that 'bounces' can be sent to.  It also helps when the email address has the same domain as the web server or email server so there are fewer questions about it being a 'legitimate' email address.

When you accept their registration, you can put up a message asking them to add that email address to their address books which usually helps make sure it gets delivered.
rapidsivaAuthor Commented:
Good Day,

But most of the case user will not add the emailID we are providing.

What are do and dont to be followed in server level and in php coding level any idea
We have our user registration in our website. once the registation is over they will get confirmation email to activate the account.

Just a reminder, in addition to DaveBaldwin's comment from technical viewpoint. Let's see another possibility from a non-technical perspective.

Even an email address is registered and activated, it does not mean the email owner would regularly access the email box and read your emails as you expect. People do use spammed email address to register some spam-looking services.

Therefore, there is NO 100% delivery guaranteed email.
rapidsivaAuthor Commented:
Ray PaseurCommented:
Here is how I handled it: http://www.constantcontact.com/index.jsp

What DaveBaldwin is telling you is correct.  The worst thing you can do is try to do all of this yourself, when a professional solution is available at a very, very modest cost.

This article may be helpful, whether you choose the professional solution or a "roll-your-own."
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.