-5

I am using zend framework and i write the following code for sending a mail from another sever.Bu t dont know why it throws the following exception.

5.7.1 This email has been blocked. The email message appeared to contain a data leak

I am using the following code

public function sendMail($a_Subject,$a_Message,$a_toMail,$a_toName,$a_frmMail,$a_frmName){

    $theConfig  =   array('auth' => 'login',
                    'username' => 'someusername.ocm',
                    'password' => 'somepass');
    $objTranpt  =   new Zend_Mail_Transport_Smtp('somehost.net', $theConfig);
    $mailObj    =   new Zend_Mail();

    $mailObj->setBodyHtml($a_Message);
    $mailObj->setFrom($a_frmMail, $a_frmName);
    $mailObj->addTo($a_toMail,$a_toName);
    $mailObj->setSubject($a_Subject);
    $mailObj->send($objTranpt);

    return true;
}

And when i try to send mail i got thw following error on my try catch..How to rersolve this??Thanks for the help in advance...

Frank Thomas
  • 35,097
  • 3
  • 77
  • 98
  • 2
    Don't cross post. You can't just go ahead and post your question on all sites. The question should go to [SO], so please ask there. You should also format your code properly. – slhck Feb 21 '13 at 13:24
  • I have rolled back the op post to its original unvandalized state. – Frank Thomas Oct 09 '13 at 11:47

1 Answers1

3

A 5.7.1 message indicates that a SMTP relay server can't or won't forward your traffic. the most common cause is bad authentication (are your username and password right?). unfourtunately, the other causes for this error are numerous and almost all are on the server end (relaying disabled globally, relaying not permitted for specific user, relaying from sending network not permitted, etc).

The folks from Mozilla explain it pretty well: http://kb.mozillazine.org/5.7.1_Unable_to_relay

in your case, simply based on the message it looks like your SMTP server is employing some form of leak protection software that is blanket denying SMTP relaying, assuming that it is someone trying to get around other established policies/protections. That you got a 5.7.1 at all means that your code was fine (other than perhaps authentication), and the issue is server configuration.

Frank Thomas
  • 35,097
  • 3
  • 77
  • 98
  • Thanks for the answer.. But i used some other host and its username and password and tried which worked me in some other project...but when i try this time the error occurs..And i spend the whole day googling but didnt find a solution.. Can u suggest me a way to resolve this???Frank Thomas – 웃웃웃웃웃 Feb 21 '13 at 13:21
  • 2
    the real problem here is the host/server you are relaying through, so it makes sense that it might have worked elsewhere and doesn't work now. unfortunately, your options (unless you fat-fingered the uname, passwd, or hostname) are to either pick a differant server to relay through, or to contact whoever runs the server in question and ask for support from them. there is no generic solution to the issue, since its all about how the host chooses to run their server. – Frank Thomas Feb 21 '13 at 13:26