Location: PHPKode > projects > phpCAMALEO > common/fun2inc/send_info.inc
<?php
if (!function_exists('emailer')) include($_SESSION[common].'fun2inc/emailer.inc');

if(!function_exists('send_info'))
{
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	# Prepare email body and send the email
	#
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	function send_info($email_to,		# destination email
					   $mail_object,	# subject
					   $mail_file,		# full path to email body
					   $reply	= '',	# reply address
					   $cc		= '',
					   $bcc		= '',
					   $from	= '',	# from address
					   $attach_path='', # path to attach file
					   $attach_file='',	# attach file
					   $host_root,		# host root
					   $r1='',			# replacement strings
					   $r2='',
					   $r3='',
					   $r4='',
					   $r5='')
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	{
		#
		$signRobot='
		Robot<br />
		<a href="http://'.$host_root.'" target="_blank">'.$host_root.'</a><br />
		PHP=linePlease do not reply to this e-mail: replies and bounced-back digests are used by our server to detect dead e-mail addresses. Instead, please contact us through the <a href="http://'.$host_root.'Contact.php?email='.$email_to.'">contact</a> page.
		PHP=line<a href="http://www.marcelino.org" target="_blank">Help working children!</a>
		PHP=line';
		#
		$signRobotASC='
		Robot
		'.$host_root.'
		----------------------------------------------------------
		Do not reply to this e-mail: replies and bounced-back digests are used by our server to detect dead e-mail addresses. Instead, please contact us through the <a href="http://'.$host_root.'Contact.php?email='.$email_to.'">contact</a> page.
		----------------------------------------------------------
		Help working children! http://www.marcelino.org
		----------------------------------------------------------';
		#
		$signUSR1='
		'.$_SESSION[misc][USR1_NAME].'
		<br />
		<a href="mailto:'.$_SESSION[misc][USR1_EMA].'">'.$_SESSION[misc][USR1_EMA].'</a><br />
		<a href="http://'.$host_root.'" target="_blank">'.$host_root.'</a><br />
		PHP=linePlease do NOT change message SUBJECT!!!<br />
		Gentilmente NON cambiare l\'OGGETTO del messaggio!!
		PHP=line<a href="http://www.marcelino.org" target="_blank">Help working children!</a>
		PHP=line';
		#
		$signUSR1ASC='
		'.$_SESSION[misc][USR1_NAME].'
		'.$_SESSION[misc][USR1_EMA].'
		'.$host_root.'
		----------------------------------------------------------
		Please do NOT change message SUBJECT!!!
		Gentilmente NON cambiare l\'OGGETTO del messaggio!!
		----------------------------------------------------------
		Help working children! http://www.marcelino.org
		----------------------------------------------------------';
		#
		$today=date('r T');
		$body='';
		if(file_exists($mail_file))
		{
			$result=file($mail_file);
			if($result)
			{
				foreach($result as $key=>$val)
				{
					$record=trim($val);
					if($comment=='')
					{
						# If '/*', switch comment on
						$pos=strpos($record, '/*');
						if($pos===false) { /* do nothing */ } else { $comment='comment'; }
					}
					#
					#	Formatting substitutions
					#
					$record=str_replace('PHP=signUSR1',		$signUSR1,		$record);
					$record=str_replace('PHP=signUSR1ASC',	$signUSR1ASC,	$record);
					#
					$record=str_replace('PHP=signRobot',$signRobot, $record);
					$record=str_replace('PHP=signRobotASC',$signRobotASC, $record);
					$record=str_replace('PHP=contact',	'http://'.$host_root.'/Contact.php?email='.$email_to, $record);
					#
					$record=str_replace('PHP=R1', $r1, $record);
					$record=str_replace('PHP=R2', $r2, $record);
					$record=str_replace('PHP=R3', $r3, $record);
					$record=str_replace('PHP=R4', $r4, $record);
					$record=str_replace('PHP=R5', $r5, $record);
					#
					$record=str_replace('PHP=host', 'http://'.$host_root, $record);
					$record=str_replace('PHP=line', '<hr id="line" />', $record);
					$record=str_replace('PHP=rev', '<font id="rev" />', $record);
					$record=str_replace('ยงยง', '</font>', $record);
					#
					#	Output
					#
					if(substr($record, 0, 2)!='<h') { $record=$record.'<br />'."\n"; }
					if($comment!='comment') { $body.=$record; }
					if($comment=='comment')
					{
						# If '*/', switch comment off
						$pos=strpos($record, '*/');
						if($pos===false) { /* do nothing */ } else { $comment=''; }
					}
				}
			}
		}
		else { $body=$mail_file; }
		$result=emailer($email_to, $mail_object, $body, $reply, $cc, $bcc, $from, 'html', '1', $attach_path, $attach_file);
		return($result);
	}
}
?>
Return current item: phpCAMALEO