Forums / General / Sending mail from template

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Sending mail from template

Author Message

François Xavier Lacroix

Thursday 07 July 2005 2:02:35 am

is there an ez way to send a mail with a special template operator ?
thx.

Philip K.

Tuesday 12 September 2006 2:21:04 am

I'm interested, too...
Is there a way to send a mail out of a template?

Linux is like a wigwam; no windows, now gates, and apache inside!

Norman Leutner

Tuesday 12 September 2006 3:13:54 am

You can simply create your own template operator which sends mail to a given mailadress...

The code should look something like:

	include_once( 'lib/ezutils/classes/ezmail.php' );
	include_once( 'lib/ezutils/classes/ezmailtransport.php' );

	$mail = new eZMail();
	$mail->setSender( $emailSender );

	$receiver = $currentUser->attribute( 'email' );
	$mail->setReceiver( $receiver);
	$mail->addBcc( $bccreceiver, $name = false );

	$subject = "SUBJECT: BLABLA";
	$mail->setSubject( $subject );
	$mail->setBody( $templateResult );
	$mailResult = eZMailTransport::send( $mail );

Take a look at the contributions to have some template operator examples...

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Philip K.

Tuesday 12 September 2006 3:28:00 am

Thanks a lot, I will try this.

Linux is like a wigwam; no windows, now gates, and apache inside!