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!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 06:13:52
Script start
Timing: Jan 31 2025 06:13:52
Module start 'layout'
Timing: Jan 31 2025 06:13:52
Module start 'content'
Timing: Jan 31 2025 06:13:52
Module end 'content'
Timing: Jan 31 2025 06:13:52
Script end

Main resources:

Total runtime0.6781 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 588.1250151.2109
Module start 'layout' 0.00570.0040 739.335936.6484
Module start 'content' 0.00960.6675 775.9844989.3047
Module end 'content' 0.67710.0009 1,765.289111.8516
Script end 0.6781  1,777.1406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.5893160.0002
Check MTime0.00150.2204160.0001
Mysql Total
Database connection0.00070.106010.0007
Mysqli_queries0.615390.7326620.0099
Looping result0.00060.0934600.0000
Template Total0.644095.020.3220
Template load0.00200.294820.0010
Template processing0.641994.668320.3210
Template load and register function0.00140.209710.0014
states
state_id_array0.00140.199510.0014
state_identifier_array0.00090.129220.0004
Override
Cache load0.00170.2484190.0001
Sytem overhead
Fetch class attribute can translate value0.00100.149430.0003
Fetch class attribute name0.00200.290170.0003
XML
Image XML parsing0.00711.040330.0024
class_abstraction
Instantiating content class attribute0.00000.003080.0000
General
dbfile0.00680.9959290.0002
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs