sendMail - different environments

46 views
Skip to first unread message

AJ Mercer

unread,
May 15, 2011, 11:31:28 PM5/15/11
to cfwh...@googlegroups.com
I am not sure if it was this framework, but I think I read somewhere about a setting for dev / test environments so emails would not be sent out or sent to a nominated address - is this possible in CFWheels?

raulriera

unread,
May 15, 2011, 11:54:13 PM5/15/11
to ColdFusion on Wheels
Yes, set this to true <cfset set("sendEmailOnError" = false)> and
<cfset set("errorEmailAddress" = false> on the environmentns you need
them

On May 16, 5:31 am, AJ Mercer <ajmer...@gmail.com> wrote:
> I am not sure if it was this framework, but I think I read somewhere about a
> setting for dev / test environments so emails would not be sent out or sent
> to a nominated address - is this possible in CFWheels?
>
> --
>
> *AJ Mercer*
> <webonix:net strength="Industrial" /> <http://webonix.net> | <webonix:org
> community="Open" /> <http://webonix.org>http://twitter.com/webonix
> Railo Community Manager <http://www.getrailo.org/index.cfm/community/team/>

raulriera

unread,
May 15, 2011, 11:54:36 PM5/15/11
to ColdFusion on Wheels
<cfset set("sendEmailOnError" = true)> * oops

AJ Mercer

unread,
May 16, 2011, 12:01:14 AM5/16/11
to cfwh...@googlegroups.com
sorry - I meant application sent emails, not system generated.
That is, my application will send out emails to clients - I dont want test emails to go to clients


--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.




--

AJ Mercer
<webonix:net strength="Industrial" /> | <webonix:org community="Open" />
http://twitter.com/webonix

Chris Peters

unread,
May 16, 2011, 8:22:58 AM5/16/11
to cfwh...@googlegroups.com
The setting is really for error emails. Having some way of suppressing emails sent by sendEmail() would be a neat plugin though!

Andy Bellenie

unread,
May 16, 2011, 9:41:12 AM5/16/11
to cfwh...@googlegroups.com
Place an override in your controller.

<cffunction name="sendMail">
<cfif get("environment") neq "production">
<cfset arguments.to = [testaddress]>
</cfif>
<cfreturn super.sendMail(argumentCollection=arguments)
</cffunction>

AJ Mercer

unread,
May 16, 2011, 10:31:32 PM5/16/11
to cfwh...@googlegroups.com
I have decided to use $deliver
    
<cfset results = sendEmail(
    ...
   $deliver="#get('environment') eq 'production'#"
)>

if set to FALSE it returns a struct

AJ Mercer

unread,
May 17, 2011, 5:44:59 AM5/17/11
to cfwh...@googlegroups.com
I have enhanced my plugin to use the $deliver attribute of SendEmail() and if set to FALSE creates a file version of the email and saves it within the plugin spool directory.

I have also created a email viewer so you can take a look at what the email looks like.
You can also delete the email files.


I tried to upload version 0.1, but not sure if it worked.


Email Inline Images v0.2

Add images to emails so they can be embedded in the HTML.
Images are to be stored in the images directory of your web root.

<cfset sendEmail(
       to='y...@test.org',
       from='ima...@test.org',
       template="templates/testHTML",
       subject="embedded Image",
       images="email/test-image.gif",
       $deliver=[TRUE|FALSE]
)>

In the image tag 'src' attribute, replace URL path with ''cid:' image id where images id are set as 'image' and sequence number, e.g.

<img alt="email banner" width="945" height="118" src="cid:image1" />

If $deliver is set to FALSE this plugin will not send the email but save it to the spool directory within the plugin folder. You can then you the use the Spool Viewerto review the output.

Spool Viewer

View Emails

Uninstallation

To uninstall this plugin, simply delete the /plugins/emailInlineImages-0.2.zip file.

Credits

This plugin was created by AJ Mercer.


Email Viewer looks like this...


View Emails

SentToFromSubjectAction
17/05/11 5:13 PMajme...@gmail.com ajme...@gmail.comYour Accolade tax report is now available onlineView | Del
17/05/11 5:13 PMajme...@gmail.comajme...@gmail.comYour Accolade tax report is now available online View | Del


View Email

Delete | Back ] 

To: ajme...@gmail.com
From: ajme...@gmail.com
Subject: Your Accolade tax report is now available online {ts '2011-05-17 17:13:25'}

 

Please be advised that your 10/11 tax report for the following account is now complete and available for you to view online.

2212345: AJM Account Name

To access this report please click here. You will need to enter your login and password details to access this report.
If you have forgotten your password you can have this resent to you by entering your email details here.

If previously requested, a hard copy report will be sent to you within 10 business days.

If you have any questions or feedback in regards to the above please contact Accolade Services

Kind Regards

Accolade Services
Patersons Securities Limited
AFSL No. 239 052

John C Bland II

unread,
May 17, 2011, 1:00:10 PM5/17/11
to cfwh...@googlegroups.com
Great looking plugin!

AJ Mercer

unread,
May 18, 2011, 1:39:39 AM5/18/11
to cfwh...@googlegroups.com
I have uploaded my work to date

Simon Allard

unread,
May 24, 2011, 3:55:21 PM5/24/11
to cfwh...@googlegroups.com
Hi AJ,

Your plugin is GREAT!!! Really handy! Good work!

A+

Simon

2011/5/18 AJ Mercer <ajme...@gmail.com>

tpet...@gmail.com

unread,
May 24, 2011, 4:37:19 PM5/24/11
to ColdFusion on Wheels
the code isn't up on github yet. :(

On May 24, 3:55 pm, Simon Allard <ellor1...@gmail.com> wrote:
> Hi AJ,
>
> Your plugin is GREAT!!! Really handy! Good work!
>
> A+
>
> Simon
>
> 2011/5/18 AJ Mercer <ajmer...@gmail.com>
>
>
>
>
>
>
>
> > I have uploaded my work to date
> >    http://cfwheels.org/plugins/listing/62
>
> > On 18 May 2011 01:00, John C Bland II <johncblan...@gmail.com> wrote:
>
> >> Great looking plugin!
>
> >> On May 17, 2011, at 4:44 AM, AJ Mercer wrote:
>
> >> I have enhanced my plugin to use the $deliver attribute of SendEmail() and
> >> if set to FALSE creates a file version of the email and saves it within the
> >> plugin spool directory.
>
> >> I have also created a email viewer so you can take a look at what the
> >> email looks like.
> >> You can also delete the email files.
>
> >> I tried to upload version 0.1, but not sure if it worked.
>
> >> Email Inline Images v0.2
>
> >> Add images to emails so they can be embedded in the HTML.
> >> Images are to be stored in the images directory of your web root.
>
> >> <cfset sendEmail(
> >>        to='...@test.org',
> >>        from='ima...@test.org',
> >>        template="templates/testHTML",
> >>        subject="embedded Image",
> >>        images="email/test-image.gif",
> >>        $deliver=[TRUE|FALSE]
> >> )>
>
> >> In the image tag 'src' attribute, replace URL path with ''cid:' image id
> >> where images id are set as 'image' and sequence number, e.g.
>
> >> <img alt="email banner" width="945" height="118" src="cid:image1" />
>
> >> If $deliver is set to FALSE this plugin will not send the email but save
> >> it to the spool directory within the plugin folder. You can then you the use
> >> the Spool Viewer<http://register.accolade.intranet/wheels/wheels?view=plugins&name=ema...>to
> >> review the output.
> >> Spool ViewerView Emails<http://register.accolade.intranet/wheels/wheels?view=plugins&name=ema...>Uninstallation
>
> >> To uninstall this plugin, simply delete the
> >> /plugins/emailInlineImages-0.2.zip file.
> >> Credits
>
> >> This plugin was created by AJ Mercer <http://webonix.net/>.
>
> >> Email Viewer looks like this...
>
> >> View EmailsSentToFromSubjectAction17/05/11 5:13 PMajmer...@gmail.com
> >> ajmer...@gmail.comYour Accolade tax report is now available onlineView<http://register.accolade.intranet/wheels/wheels?view=plugins&name=ema...>
> >>  | Del<http://register.accolade.intranet/wheels/wheels?view=plugins&name=ema...> 17/05/11
> >> 5:13 PMajmer...@gmail.comajmercer@gmail.comYour Accolade tax report is
> >> now available online View<http://register.accolade.intranet/wheels/wheels?view=plugins&name=ema...>
> >>  | Del<http://register.accolade.intranet/wheels/wheels?view=plugins&name=ema...>
>
> >> View Email[ Delete<http://register.accolade.intranet/wheels/wheels?view=plugins&name=ema...>
> >>  | Back<http://register.accolade.intranet/wheels/wheels?view=plugins&name=ema...>
> >>  ]
>
> >> *To: *ajmer...@gmail.com
> >> *From: *ajmer...@gmail.com
> >> *Subject: *Your Accolade tax report is now available online {ts
> >> '2011-05-17 17:13:25'}
> >> ------------------------------
>
> >> Please be advised that your 10/11 tax report for the following account is
> >> now complete and available for you to view online.
>
> >> *2212345: AJM Account Name*
>
> >> To access this report please click here<http://secure.psl.com.au/my-accounts>.
> >> You will need to enter your login and password details to access this
> >> report.
> >> If you have forgotten your password you can have this resent to you by
> >> entering your email details here<https://secure.psl.com.au/client/forgotUsername>
> >> .
>
> >> If previously requested, a hard copy report will be sent to you within 10
> >> business days.
>
> >> If you have any questions or feedback in regards to the above please
> >> contact Accolade Services
>
> >> Kind Regards
>
> >> Accolade Services
> >> *Patersons Securities Limited*
> >> AFSL No. 239 052
>
> >> On 16 May 2011 20:22, Chris Peters <ch...@clearcrystalmedia.com> wrote:
>
> >>> The setting is really for error emails. Having some way of suppressing
> >>> emails sent by sendEmail() would be a neat plugin though!
>
> >>> On Mon, May 16, 2011 at 12:01 AM, AJ Mercer <ajmer...@gmail.com> wrote:
>
> >>>> sorry - I meant application sent emails, not system generated.
> >>>> That is, my application will send out emails to clients - I dont want
> >>>> test emails to go to clients
>
> >>>> <webonix:net strength="Industrial" /> <http://webonix.net/> | <webonix:org
> >>>> community="Open" /> <http://webonix.org/>
>
> >>>>http://twitter.com/webonix
> >>>> Railo Community Manager<http://www.getrailo.org/index.cfm/community/team/>
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "ColdFusion on Wheels" group.
> >>>> To post to this group, send email to cfwh...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to
> >>>> cfwheels+u...@googlegroups.com.
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/cfwheels?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "ColdFusion on Wheels" group.
> >>> To post to this group, send email to cfwh...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> cfwheels+u...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/cfwheels?hl=en.
>
> >> --
>
> >> *AJ Mercer*
> >> <webonix:net strength="Industrial" /> <http://webonix.net/> | <webonix:org
> >> community="Open" /> <http://webonix.org/>

AJ Mercer

unread,
May 24, 2011, 8:57:02 PM5/24/11
to cfwh...@googlegroups.com

AJ Mercer

unread,
Jun 1, 2011, 1:49:57 AM6/1/11
to cfwh...@googlegroups.com
I have uploaded some enhancements

Version 0.3

  • if $deliver is FALSE, plugin actually does spool the email now
  • Now handles File attachments
  • Added CC and BCC support
  • Can edit To, CC & BCC before sending email from Email View
  • init() has comments show how to add routes
  • Uses XML file rather than cfmail (.cfmail like to be ditched)

DustMason

unread,
Jun 1, 2011, 7:30:48 PM6/1/11
to ColdFusion on Wheels
as a side note for those working on email features in a development
environment, check out https://github.com/sj26/mailcatcher

its basically just a tiny SMTP server that you can send emails to for
viewing in a browser. written in ruby but works with anything that
uses SMTP. simply change the SMTP settings in your development
environment to use it. very handy!

On May 31, 10:49 pm, AJ Mercer <ajmer...@gmail.com> wrote:
> I have uploaded some enhancements
> Version 0.3
>
>    - if $deliver is FALSE, plugin actually does spool the email now
>    - Now handles File attachments
>    - Added CC and BCC support
>    - Can edit To, CC & BCC before sending email from Email View
>    - init() has comments show how to add routes
>    - Uses XML file rather than cfmail (.cfmail like to be ditched)
>
> --
> *AJ Mercer*
> <webonix:net strength="Industrial" /> <http://webonix.net> | <webonix:org
> community="Open" /> <http://webonix.org>http://twitter.com/webonix
> Railo Community Manager <http://www.getrailo.org/index.cfm/community/team/>

AJ Mercer

unread,
Jun 25, 2011, 7:01:53 PM6/25/11
to cfwh...@googlegroups.com
openBD is now able to do this
    -> catchemail

Andy Bellenie

unread,
Jun 27, 2011, 6:37:08 PM6/27/11
to cfwh...@googlegroups.com
You can set a global variable for it. I add <cfset
set(adminEmailAddress=xxx)> in my settings.cfm. Then I can set
different ones for different environments.

You can also override the sendMail() function to do nothing if not in
the correct environment, or perhaps only on specific server domains.

Reply all
Reply to author
Forward
0 new messages