We help IT Professionals succeed at work.

Why is this email pipe resulting in a bounce back?

soparrissays
soparrissays asked
on
Medium Priority
342 Views
Last Modified: 2012-06-22
Hi,
So I have a shared hosting account. My host uses cpanel. I believe I have the address to my script is correct (99% sure). Everytime i try to send to this email address I get a bounce back. I am not quite sure why.

Do I need a hashbang with all my included files also?

Finally how do i get the email address of the sender. I am not quite sure...
#!/usr/bin/php
<?php
    require_once('classes/class.formatmail.php');
	$emails = array(
		array('name'=>'XXX','email'=>'XXX')
	);
	
	$fd = fopen("php://stdin", "r"); 
 
	$contents = "";
	while (!feof($fd)) {
  		$contents .= fread($fd, 8192);
	}
 
	fclose($fd);
 
	$GLOBALS['CONTENT']=$contents;
 
	foreach ($emails as $email){
			
			$GLOBALS['NAME']=$email['name'];
			$GLOBALS['EMAIL']=$email['email'];
			
			$FM=new FormatMail('templates/email.htm');
			
			$FM->Mailer->FromName='xxx';
			$FM->Mailer->From='xxx';
			$FM->Mailer->Subject='xxx';
			$FM->Mailer->AddAddress($email,$name);
		
			if ($FM->Send())
			echo 'Mail sent successfully to: '.$name.' with email: '.$email;
			
			//Or echo the result
			//echo $FM->Message;
		}
	}
?>

Open in new window

Comment
Watch Question

Most Valuable Expert 2011
Author of the Year 2014

Commented:
This appears to be a data dependent problem, right?  If that is the case, we need to see the actual data, not a string of XXX.  Also where did you get the class you're using?  Does it have a manual?  Thanks, ~Ray

Author

Commented:
I am using php mailer. Below is the real source. I didn't want google to find real email addresses and such.

Manual could be found at: http://phpmailer.codeworxtech.com/

I have gotten that script to work for a few email campaigns.

Thanks
#!/usr/bin/php
<?php
    require_once('classes/class.formatmail.php');
	
	$fd = fopen("php://stdin", "r"); 
 
	$contents = "";
	while (!feof($fd)) {
  		$contents .= fread($fd, 8192);
	}
 
	fclose($fd);
	
	$GLOBALS['CONTENT']=$contents;
	
	foreach ($emails as $email){
			
			$GLOBALS['NAME']=$email['name'];
			$GLOBALS['EMAIL']=$email['email'];
			
			$FM=new FormatMail('templates/email.htm');
			
			$FM->Mailer->FromName='Blue Sky Research';
			$FM->Mailer->From='bluesky@parrisstudios.com';
			$FM->Mailer->Subject='Blue Sky Research: ';
			$FM->Mailer->AddAddress($email,$name);
		
			if ($FM->Send())
			echo 'Mail sent successfully to: '.$name.' with email: '.$email;
			
			//Or echo the result
			//echo $FM->Message;
		}
	}
?>

Open in new window

Author

Commented:
Opps i forgot this line also!
$emails = array(
		array('name'=>'Parris Khachi','email'=>'president@parrisstudios.com')
	);

Open in new window

Author

Commented:
Furthermore, I believe it was actually extended upon using this:
http://www.phpclasses.org/browse/package/4244.html
Most Valuable Expert 2011
Author of the Year 2014

Commented:
Sorry -- I'm having server issues here, so my last comment was lost.  Have you considered using a service like Constant Contact?

Author

Commented:
That may be an easy way out of this haha. The script seemed like it should work, and it does for the most part. It just doesn't like the whole pipping thing. I suppose?

I'll look into it.
Most Valuable Expert 2011
Author of the Year 2014
Commented:
Honestly, I've wrestled with sending email for years and it is always a moving target.  There are too many external factors - blacklists, ISP turf wars, incompetent server admins, surprise (and inaccurate) spam filters, MX snafus, etc.  The list is endless.  In the end I have spent thousands of hours on the subject and the problem has NEVER been the email message or the headers.  And that's why I am leaning toward Constant Contact.  Our church sends 1900 messages a week.  At those levels, it's so cheap to use that it is almost free.  And they have a small army of people who spend their professional lives making sure email goes through.  It looks like a good deal to me!

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Definitely. This is true! Thanks for the advice.
Most Valuable Expert 2011
Author of the Year 2014

Commented:
And thanks for the points.  I'm all about getting results, and I wish you the best with this project, ~Ray
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.