Jump to content

Recommended Posts

Help! I have been trying for weeks and am stumped. Our servers keep blocking the email sent from anything I create. I am doing the test only so far. and when I make the TO

 

// Add an address to send to.

$mailer->AddAddress('njacob@camdendiocese.org', 'Eric Rosebrock');

 

the camdendiocese.org servers keep blocking the email. Any suggestions on how to get around this? When I change it to my home address; a hotmail account. The whole thing works great.

Link to comment
https://forums.phpfreaks.com/topic/51671-server-keeps-blocking-the-email/
Share on other sites

It appears you are using PHPMailer and if so try:

$mailer->Sender = 'valid@email.com';

 

I encountered a similar type of issue, and I'm not sure if the problem your having is the same as mine but I will post the solution that I found as well.

 

I was using a basic implementation of PHP's mail function and wasn't receiving the emails that were being sent. The logs from my incoming mail server told me that the emails had been rejected because it couldn't check the return path (some mail servers do this to block spam).

 

I had to set an extra parameter like so:

mail($to, $subject, $body, $headers, " -f valid@email.com");

 

This from PHPMailer's documentation:

$Sender

    PHPMailer::$Sender in class.phpmailer.php

    Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.

 

 

$Sender

    PHPMailer::$Sender in class.phpmailer.php

    Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.

 

 

This from http://www.php.net/function.mail

 

If you're using a linux server using Postfix, and your server hasn't the host name set to a valid name (because it's behind a firewall in an intranet), it's possible that when sending mails using the mail function, some mail servers reject them. This is because they can't check the return path header. If you want to change the Return-Path used by sendmail init the php.ini and edit the sendmail_path variable to this:

 

sendmail_path = "sendmail -t -i -F webmaster@yoursite.com -f webmaster@yoursite.com"

 

Hope this helps.

 

Cheers!

I did this and it is wrong:

 

  /**

    * Sets the Sender email (Return-Path) of the message.  If not empty,

    * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.

    * @var string

    */

    var $Sender            = "mail($to, $subject, $body, $headers, " -f webmaster@camdendiocese.org");";

 

cn you tell me the right way to word it?

in class.phpmailer.php?  because i did this:

 

/**

    * Sets the Sender email (Return-Path) of the message.  If not empty,

    * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.

    * @var string

    */

    var $Sender            = "";

$mailer->Sender = 'valid@email.com';

 

and i got this:

Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/camdendi/public_html/lib/phpmailer/class.phpmailer.php on line 75

 

 

OHH GOSH this is so confusing!

Revert any changes you made to class.phpmailer.php!

 

In your script where you are sending the email change it to look like this:

 

// Add an address to send to.

$mailer->AddAddress('njacob@camdendiocese.org', 'Eric Rosebrock');

$mailer->Sender('njacob@camdendiocese.org');

Its says

 

Fatal error: Call to undefined method: freakmailer->sender() in /home/camdendi/public_html/mailtest.php on line 20

 

line 20 is

 

// Add an address to send to.

$mailer->AddAddress('njacob@camdendiocese.org', 'Eric Rosebrock');

$mailer->Sender('njacob@camdendiocese.org');      <----line 20

 

now what... I have about 5 people working on this. and we are all confused. this is supposed to be simple.

fyi many servers are creating an auto blacklist policy like aol (oh aol ;)) and you must pay to get removed off blacklisted onto whitelist and then there are fees per email beyond that so its a coming age when we will have to start doing route arounds with php and maybe ajax

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.