Jump to content

Not two To: headers


Herward

Recommended Posts

Am still learning and need help with the following.

 

My php script on the server sends out a daily message to a list of subscribers.

Of late I am receiving a 550 error message from mainly email addresses that are held by large portals like gmail, yahoo, hotmail, aol, etc.

The bounced emails are sent back to my server with the server's general email address.

Here is a typical example:

 

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  boldarn@hotmail.com
    SMTP error from remote mail server after end of data:
    host spamexperts1.genwebserver.com [216.15.166.132]:
    550 Messages should have one or no To headers, not 2.

------ This is a copy of the message, including all the headers. ------

Return-path: <h3rw1d@alvin.genwebserver.com>
Received: from h3rw1d by alvin.genwebserver.com with local (Exim 4.80.1)
        (envelope-from <h3rw1d@alvin.genwebserver.com>)
        id 1VfXRe-003Hg6-Cb; Sun, 10 Nov 2013 10:01:02 -0600
To: boldarn@hotmail.com
Subject: Daily/Monthly Numeroscopes for Monday, November 11th, 2013 by certuspersonality.com
From: <do-not-reply@certuspersonality.com>
To: Arne <boldarn@hotmail.com>
Content-Type: text/html
Message-Id: <E1VfXRe-003Hg6-Cb@alvin.genwebserver.com>
Sender:  <h3rw1d@alvin.genwebserver.com>
Date: Sun, 10 Nov 2013 10:01:02 -0600

<p>Dear Arne,</p>

...snip...

 

The error is that there are two To: addresses given in the headers (see above) which is not permissible by the receiving server.

 

Question.

What should the outgoing headers look like with only one To: address?

 

Thanks for your help.

 

Herward

 

 

 

Link to comment
Share on other sites

 

What should the outgoing headers look like with only one To: address?

The headers will be the same, except there should only be one To: header, which should be set to the email address you are sending the email to.

 

Something in your code is setting multiple To: headers which is causing the error. You need to debug your PHP script that is sending the emails.

Edited by Ch0cu3r
Link to comment
Share on other sites

Here is the enire cron job file (cron.php) that send out the daily emails.

 

<?php
    ini_set('display_errors', 'On');
    $time = time();
    require_once 'incs/config.php';
    require_once 'incs/functs.php';
    $query = 'SELECT * FROM dn_subs WHERE next_email < '.$time.' AND next_email > 0 AND verified_on > 0';
    $qh = query($query);
    while ($row = mysql_fetch_assoc($qh))
    {
        $rdiff = $row['timezone'] - (-5);        
        if ($rdiff > 0)
            $time = strtotime('+'.$rdiff.' hours', time());
        else
            $time = strtotime($rdiff.' hours', time());
        $tdiff = time() - $time;
        $row['fyear'] = date('Y', $time);
        $row['fmonth'] = date('n', $time);
        $row['fday'] = date('j', $time);
        $_REQUEST = $row;
/*        ob_start();
        include 'totdnumeros-email-nr.php';
        $email_cont = ob_get_contents();
        ob_end_clean();
*/
        $url = 'http://www.certuspersonality.com/dnumeroscope/totdnumeros-email-nr_tda.php?id='.$row['id'].'&ch='.md5('d'.$row['id'].'e').'&time='.$time;
        $url2 = 'http://www.certuspersonality.com/dnumeroscope/totdnumeros-email-nr_tmo.php?id='.$row['id'].'&ch='.md5('d'.$row['id'].'e').'&time='.$time;
        $url3 = 'http://www.certuspersonality.com/mnumeroscope/totmnumeros-email-nr_tmt.php?id='.$row['id'].'&ch='.md5('d'.$row['id'].'e').'&time='.$time;
        $url4 = 'http://www.certuspersonality.com/mnumeroscope/totmnumeros-email-nr_nmt.php?id='.$row['id'].'&ch='.md5('d'.$row['id'].'e').'&time='.$time;
        $sus_url = 'http://www.certuspersonality.com/dnumeroscope/unsubdnumeros-email-nr.php?email='.urlencode($row['email']);
        $email_cont = '<p>Dear '.$row['nickname'].',</p>
<p></p>
This is a special free service from certuspersonality.com.
<p></p>
Your Daily and Monthly Numeroscopes are now available!
<br />
Click on the links below.
<p></p>
Today\'s numeroscope:
<br />
<a href="'.$url.'">'.$url.'</a>
<p></p>
Tomorrow\'s numeroscope:
<br />
<a href="'.$url2.'">'.$url2.'</a>
<p></p>
The energies of the days are embedded in those of their months, so you have to be aware of them.
<p></p>
This Month:
<br />
<a href="'.$url3.'">'.$url3.'</a>
<p></p>
The Month ahead:
<br />
<a href="'.$url4.'">'.$url4.'</a>
<p></p>
Organize your life wisely!
<br />
certuspersonality.com.
<p></p>
To unsubscribe, go to:
<br />
<a href="'.$sus_url.'">'.$sus_url.'</a>';
        $sub = 'Daily/Monthly Numeroscopes for '.date('l, F jS, Y', $time).' by certuspersonality.com';
        $headers = 'From: <do-not-reply@certuspersonality.com>'."\r\n";
        // $headers .= 'To: '.$row['nickname'].' <'.$row['email'].'>'."\r\n";
        $headers .= 'Content-Type: text/html'."\r\n";
        mail($row['email'], $sub, $email_cont, $headers);
        //echo date('m/d/Y H:i:s', $time)."\r\n";
        $next_time = strtotime('+1 day', $time);
        $row['fyear'] = date('Y', $next_time);
        $row['fmonth'] = date('n', $next_time);
        $row['fday'] = date('j', $next_time);
        $ntime = mktime(1, 0, 0, $row['fmonth'], $row['fday'], $row['fyear']);
        //echo date('m/d/Y H:i:s', $ntime)."\r\n";
        if ($rdiff > 0)
            $ntime = strtotime('-'.abs($rdiff).' hours', $ntime);
        else
            $ntime = strtotime('+'.abs($rdiff).' hours', $ntime);
        //echo date('m/d/Y H:i:s', $ntime);
        $sql = 'UPDATE dn_subs SET next_email = '.$ntime.' WHERE id = '.$row['id'];
        query($sql);
    }
?>
 

Link to comment
Share on other sites

In your actual code, is the following line commented out?

 // $headers .= 'To: '.$row['nickname'].' <'.$row['email'].'>'."\r\n";

The first argument for the mail() function is where the TO address should go. You currently have $row['email'] there:

mail($row['email'], $sub, $email_cont, $headers);
Link to comment
Share on other sites

I wrote this lttle project many years ago and have not done php since. So, now I am pretty lost.

 

To answer your question: Yes, that line like looks like being commented out but may be not properly.

 

To get somewhere, could you write down the block of the lines we are looking at, in a a corrected fashion?

I could then test them.

 

PS.

As said in the opening, the 550 bounce only occurs where the subsciber has a webmail acount with portals like gmail, yahoo etc.

They were alright over the years with the above cron.php that I currently run.

On Oct 31 these portals all bounced my emails and have done so since then. Something must have changed with them.

Via my server techs I learn that these portals now only accept messages in RFC format. I don't know what that means in regard to my cron.php.

Link to comment
Share on other sites

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.