r4 - 07 Apr 2005 - 15:37:17 - LynnwoodBrownYou are here: TWiki >  Codev Web > AddEmailToFunc
Tags:
, create new tag
The Func API has needed Email support for so long, it hurts me to think about it.

sendEmail ( $text, $retries ) -> $error

  • $text - text of the mail, including MIME headers
  • $retries - number of times to retry the send (default 1)

Send an email specified as MIME format content. To specify MIME format mails, you create a string that contains a set of header lines that contain field definitions and a message bodysuch as:

To: liz@windsor.gov.uk
From: serf@hovel.net
CC: george@whitehouse.gov
Subject: Revolution

Dear Liz,

Please abolish the monarchy (with King George's permission, of course)

Thanks,

A. Peasant
Leave a blank line between the last header field and the message body.

Since: TWiki::Plugins::VERSION 1.026

wikiToEmail( $wikiName ) -> $email

  • $wikiName - wiki name of the user
Get the email address(es) of the named user. If the user has multiple email addresses (for example, the user is a group), then the list will be comma-separated.

Since: TWiki::Plugins::VERSION 1.026

-- CrawfordCurrie - 07 Apr 2005

Does it log an error if it fails to send? I assume it should not throw one.

-- MartinCleaver - 07 Apr 2005

It returns an error string. it does not log the error (caller responsibility).

I also changed the implementation to allow you to plug in an alternative mail handler (i.e. neither SMTP nore sendMail). I had to do something to support debug, and it'll probably be useful to someone to be able to do this without hacking the core.

-- CrawfordCurrie - 07 Apr 2005

FWIW, you might look at the script around which I created MailPageAddOn. It does a very nice job of sending properly formatted HTML emails (and much better than webnotify I might add). Don't know if there's anything really useful for your effort but just thought I'd mention it. Thanks for working on this feature!

-- LynnwoodBrown - 07 Apr 2005

 
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo