Add Comment
Sending email from a flex form
Flex / ColdFusion Tutorial #8
To send e-mail with CF is very simple! With Flex it is not different.
We will use the simple integration of Flex with CF to set up a contact form!
We will use Remote Object Services to accomplish the connection between Flex and CF, through FlashRemoting that comes with CF 7 and 8.
SendingEmail.mxml
The application is very simple, without validation use and it is based on this example: SendingEmail.mxmlVery simple also. I defined a name for the service, called here myCFC, the destiny, ColdFusion and the source of the used component. Soon afterwards I defined the method to be used through the tag, call of the result up there and of the fault exhibiting the message in case it happens some mistake.
To do use of the function that we created above, sendEmail, we defined her in the click of the button.
cfcApp.cfc
Now your CFC. Save the code lower inside of the paste components in the root of the project cfcApp.cfcVery simple also, just a function to send email, now is only to compile the project and to do their tests. You can join more functionalities as validations, enclosures, etc!
Demo
See this code running!
Download
Download this code as a zip!
Comments
I just download the file and run but its not working its shows this error [faultCode:InvokeFailed faultString:'[MessagingError message='Destination 'ColdFusion' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']' faultDetail:'Couldn't establish a connection to 'ColdFusion'] please give the answer..ananthi @ Friday 09 Jan 2009 - 05:39:52 PM
how to establish a connection to ColdFusion
Ananthi @ Friday 09 Jan 2009 - 07:39:07 PM
which the version of CF?
Francisco Paulino - Tofinha @ Friday 09 Jan 2009 - 10:39:39 PM
coldfusion 8
ananthi @ Friday 09 Jan 2009 - 11:02:29 PM
in CFAdmin, Date & Services > Flex Integration, the option Enable Remoting Flash support is marked?
Francisco Paulino - Tofinha @ Friday 09 Jan 2009 - 11:13:12 PM
ya! its marked
ananthi @ Friday 09 Jan 2009 - 11:23:20 PM
its marked but its not working its shows this error [faultCode:Server.Processing faultString:'Unable to invoke CFC - Could not find the ColdFusion Component or Interface cfmapping.sendEmail.cfcApp.' faultDetail:'Ensure that the name is correct and that the component or interface exists.']
ananthi @ Friday 09 Jan 2009 - 11:31:14 PM
hum… some another Flex/CF project shows this message?
try to install the CF again
Francisco Paulino - Tofinha @ Friday 09 Jan 2009 - 11:38:14 PM
now the problem is of mapping of the CFC.
it verifies the correct mapping of the CFC
Samplem If your app:
C:\Coldusion8\wwwroot\sendEmail\cfcApp.cfc
in source of MXML:
source="sendEmail.cfcApp"
Francisco Paulino - Tofinha @ Friday 09 Jan 2009 - 11:44:52 PM
oh sorry! i can change and then run its shows this error [faultCode:Server.Processing faultString:'Unable to invoke CFC - No SMTP server specified for the cfmail tag.' faultDetail:'To send SMTP mail messages, ColdFusion requires that a default SMTP server be specified. You can set the default SMTP server using the Mail page of the ColdFusion Administrator. Alternatively, you can ensure that all cfmail tags have a server attribute. In this case, no server attribute was provided and no default SMTP server setting has been specified.']
ananthi @ Saturday 10 Jan 2009 - 12:28:52 AM
it verifies the configurations of the smtp in: CFAdmin > Server Settings > Mail
Francisco Paulino - Tofinha @ Saturday 10 Jan 2009 - 02:36:13 AM
oh again sorry for disturb u.. i will change and run but its shows [Message sent with success for baa_boo@hotmail.com] i will verify the mail its not come to my inbox.
ananthi @ Saturday 10 Jan 2009 - 06:06:33 PM
No problems.
You should verify if entered with valid configurations in CFAdmin> Mail, as smtp, user and valid password. The ideal is to test in a server of production instead of development.
Francisco Paulino - Tofinha @ Sunday 11 Jan 2009 - 04:47:39 AM
plz help me configuring mail server step by step.
i am using CF trial version standlone system
ananthi @ Monday 12 Jan 2009 - 03:47:38 PM
type a smtp, user and valid password
look:
http://www.tofinha.com.br/enclosures/cfadmin_mail.png
Francisco Paulino - Tofinha @ Monday 12 Jan 2009 - 11:06:54 PM
may i upload my php file to my server?
ananthi @ Monday 12 Jan 2009 - 11:42:52 PM
Yes, but would not a file .cfm?
Francisco Paulino - Tofinha @ Monday 12 Jan 2009 - 11:54:44 PM
sorry i don't have php file only CFC file what can i do?
ananthi @ Tuesday 13 Jan 2009 - 03:28:54 PM
plz help me! i don't have php file only CFC file what can i do?
ananthi @ Monday 19 Jan 2009 - 06:06:59 PM
I don't understand. This tutorial makes use of ColdFusion and not of PHP
you are using this tutorial with PHP or with ColdFusion?
Francisco Paulino - Tofinha @ Monday 19 Jan 2009 - 10:22:17 PM
ya! i am also using the same tutorial ColdFusion.
ananthi @ Monday 19 Jan 2009 - 11:26:12 PM
make upload of the file CFC for you server.
Francisco Paulino - Tofinha @ Monday 19 Jan 2009 - 11:37:12 PM
Now i am able to sent mail.... Thanks lot for ur patientcy. Really i am very happy to this..
ananthi @ Saturday 24 Jan 2009 - 03:53:05 PM
Good, very good!
No problems! :-D
Francisco Paulino - Tofinha @ Saturday 24 Jan 2009 - 10:22:42 PM
Hi,
I am new for flex,i having flex 3 only,don't have CF any possible to send mail?
aravindakumar @ Monday 25 May 2009 - 11:12:42 PM
Yes its possible with a httpservice. You will need some sort of language on the server to send mail though. What server side language do you have access to?
Paul Kukiel @ Tuesday 26 May 2009 - 10:56:27 PM
Hi, i installed ColdFusion8 and downloaded this mail sender example and tried to run. But it shows the following error "faultCode:invokeFailed faultString:'[MessagingError message = 'Destination ColdFusion either does not exist or the destination has no channels defined(and the application des not define any default channels.)']' faultDetail:'Couldn't establish a connection to 'ColdFusion' ". Please help me resolve this problem.
Vinodh @ Saturday 13 Jun 2009 - 04:26:33 PM
When you created the Flex project in FlexBuilder sis you select ColdFusion as the server type?
Paul @ Saturday 13 Jun 2009 - 11:27:21 PM
Hi,Paul. Thanks for your suggestion. Now i had chosen ColdFusion as server type and even now if try to run it, the following error appears "faultCode:Server.Processing faultString:'Unable to invoke CFC - Could not find the ColdFusion Component or Interface cfmapping.sendEmail.cfcApp.' faultDetail:'For details turn on Robust Exception Information in the ColdFusion Administrator' " Please help me resolve this.
Vinodh @ Sunday 14 Jun 2009 - 02:54:31 AM
Do you have the mapping setup? The source="cfmapping.sendEmail.cfcApp" is a mapping setup in cfide. You can leave this as just the cfc name "source="cfcApp" and drop the cfc into the webroot and test that way.
Paul @ Sunday 14 Jun 2009 - 02:59:10 AM
I have to send group of mail on non office hour ,so i created cfschedule to set a futurew time for send a mail,when i run this page ,mail has been sent immediatly,not sending for a schedule time
thangapandyan @ Thursday 11 Mar 2010 - 04:25:25 PM
I have to send group of mail on non office hour ,so i created cfschedule to set a future time for send a mail,when i run this page ,mail has been sent immediatly,mail hasn't sent for a schedule time
thangapandyan @ Thursday 11 Mar 2010 - 04:29:28 PM
Click button to add a comment
Author
Francisco Paulino