Extra mail headers

A place for users and developers of the Xataface to discuss and receive support.

Postby ozrebel » Wed Nov 29, 2006 12:16 am

Here's yet another question sorry!

Is it possible to add extra mail headers into a dataface trigger.

I would like to be able to add header information.

Cheers

Tony
ozrebel
 
Posts: 18
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Nov 29, 2006 11:18 am

Yes. I guess you're referring to the trigger example in the tutorial which used the PHP mail() function. Check out the php.net mail manual for how to do this.
http://ca3.php.net/manual/en/function.mail.php

Alternatively you can use any of the multitude of PHP libraries for sending email.
e.g. The PEAR classes:
http://pear.php.net/packages.php?catpid=14&catname=Mail

Or PHP Mailer:
http://phpmailer.sourceforge.net/

Hope this helps a little.

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ozrebel » Wed Nov 29, 2006 8:25 pm

Thanks Steve.

Running the following code:



Produces the following error:

Warning: Cannot modify header information - headers already sent by (output started at /home/mistro/public_html/dataface/cda/tables/cda_order/cda_order.php:20) in /home/mistro/public_html/dataface/actions/new.php on line 147

I tried commenting out line 147 in new.php with no joy.

Any other pointers?

Tony
ozrebel
 
Posts: 18
Joined: Wed Dec 31, 1969 5:00 pm

Postby ozrebel » Wed Nov 29, 2006 9:10 pm

Damn - the code doesn't show up!

Maybe without the php tags it will:

class tables_cda_order {

/**
* Trigger that is called after Course record is inserted.
* @param $record Dataface_Record object that has just been inserted.
*/
function afterInsert(&$record){
mail('tfrancis@mistro.ag', 'New CDA Order Added', 'A new CDA Order has just been added to the database. Please visit the CDA website at http://cda.mistro.ag as soon as possible to view it.', 'From: tfrancis@mistro.ag' . "\r\n" .
'Reply-To: tfrancis@mistro.ag' . "\r\n" .
'X-Mailer: PHP/' . phpversion());
}
}
ozrebel
 
Posts: 18
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Thu Nov 30, 2006 10:24 pm

OK.. this is probably the most frequently encountered problems with PHP. The problem actually occurs at the end of your cda_order.php file and not the new.php file. There is extra white space after your closing ?> tag. Removing this white space will fix the problem.

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ozrebel » Fri Dec 01, 2006 4:22 pm

Man you're good!!

Thanks again for all your help. I've now got this application ready for publication, so I can take my time and potter around tinkering with things to find out all of the other great features dataface has got. I have also downloaded LCMS, so I'll have a go at installing that with a view long term to maybe moving away from Joomla.

Cheers

Tony
ozrebel
 
Posts: 18
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Dec 01, 2006 5:05 pm

Thanks for downloading LCMS.. realistically Joomla is much more mature and feature rich with a bigger community than LCMS. LCMS is just a nice little thing that allows you to store some of your pages in the database (and easily add multilingual features if desired)... but it can't compare in features to one of the big CMSs (Plone, Drupal, Mambo, Joomla)..

But if you're looking for something light-weight and simple, then LCMS might be good for you.

Best regards

Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 5 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved