Link to home
Start Free TrialLog in
Avatar of soparrissays
soparrissays

asked on

Why is this email pipe resulting in a bounce back?

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

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

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
Avatar of soparrissays
soparrissays

ASKER

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

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

Open in new window

Furthermore, I believe it was actually extended upon using this:
http://www.phpclasses.org/browse/package/4244.html
Sorry -- I'm having server issues here, so my last comment was lost.  Have you considered using a service like Constant Contact?
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.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Definitely. This is true! Thanks for the advice.
And thanks for the points.  I'm all about getting results, and I wish you the best with this project, ~Ray