Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Email data from form to my email

New Here ,
Aug 27, 2009 Aug 27, 2009

Hi,

I have a ColdFusion form; I need this form mail to my email address. I use this line of code:

<FORM METHOD=POST ACTION="mailto:nikoo56@yahoo.com" ENCTYPE="text/plain">

Also I tried <cfform tag too.

It doesn’t give me any error but I'm not getting any email too. Even when I try this code in simple .html page it doesn’t send any email as well. Is there any problem with my computer should I change any setting or does it have any other way make it work.

I really appreciate your help.

Thanks,

1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Sep 02, 2009 Sep 02, 2009

Hi There,

Inside the <cfmailpart> tags input your form elements as such:

<cfmailpart type="text"><!--- Comment - Sends a plain text version --->

#form.[element_name]# <!--- Do this for each form element you want sent --->

</cfmailpart>

<cfmailpart type="html"><!--- Comment - Sends and html verson --->

#form.[element_name]# <!--- Do this for each form element you want sent --->

</cfmailpart>

Leonard

Translate
LEGEND ,
Aug 27, 2009 Aug 27, 2009

I think that only works with links.  Cold Fusion has a cfmail tag you can use.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 27, 2009 Aug 27, 2009

I have not seen that used in a long time. IIRC, support for it was 'iffy at best.

http://support.microsoft.com/kb/279460

Cold Fusion has a cfmail tag you can use.

+1

CFMail runs on the CF server, so it is not dependent on client configuration like "mailto".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 29, 2009 Aug 29, 2009

Hi,

The following should take care of your situation.

For example purposes, lets say your .cfm page is called: mail_form.cfm

In the body of the mail_form.cfm page, enter the following code structure.

When this page is opened in a browser the first thing displayed is your form.

After completing the form and clicking on the "Send" button, the second part

of the code structure will be processed thus sending an e-mail containing the

input content of the form.

Text inserted between <- Comment -> can be removed when coding into the

page as it is not required for functionality.

Leonard

<== Code Sample To Try ==>

<cfif IsDefined('form.btn_send')>

<=============>

<=============>

<cfmail
to="nikoo56@yahoo.com"
from="[Enter email address]"
subject="[Enter a subject]"
server="mail.servername.com/org/net/us, etc."
username="[Enter approrpiate username - mail server]"
password="[Enter appropriate password - mail server ]">

<cfmailpart type="text"><- Comment - Sends a plain text version

<- Comment - Enter email body content --->

<- Comment - Do not use any html code at all in this section --->

</cfmailpart>

<cfmailpart type="html"><- Comment - Sends and html verson

<- Comment - Enter email body content --->

<- Comment - Can use html code  here --->

</cfmailpart>

</cfmail>

<- Comment - By adding the following <cflocation> tag into the process, you reduce

and/or eliminate the chance of multiple e-mails being sent if the page

gets refreshed.

<cflocation url="mail_form.cfm?send_status=Successful" addtoken="no">

<=============>

<=============>

<cfif IsDefined('url.send_status' AND Trim(url.send_status) eq "Successful">

<=============>

<=============>

<- Comment - Enter code to let you know that the process has been processed

successfully ->

<=============>

<=============>

<cfelse>

<=============>

<=============>

<cfform
action="mail_form.cfm"
method="post"
enctype="multipart/form-data"
name="mail_form"
preloader="no"
id="mail_form"
lang="en"
dir="ltr">

<- Comment Form element code here ->

<cfinput

type="submit"

name="btn_send"

id="btn_send_mail"

dir="ltr"

lang="en"

value="Send">


</cfform>

<=============>

<=============>

</cfif>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 02, 2009 Sep 02, 2009

Thanks a lot for the help. It works perfect and send the email but it doesn’t send the form inputs. Email is empty. Is there anything I need to do?

Thanks,

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 02, 2009 Sep 02, 2009

Hi There,

Inside the <cfmailpart> tags input your form elements as such:

<cfmailpart type="text"><!--- Comment - Sends a plain text version --->

#form.[element_name]# <!--- Do this for each form element you want sent --->

</cfmailpart>

<cfmailpart type="html"><!--- Comment - Sends and html verson --->

#form.[element_name]# <!--- Do this for each form element you want sent --->

</cfmailpart>

Leonard

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 03, 2009 Sep 03, 2009

Thanks a lot Leonard, It works perfect.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 03, 2009 Sep 03, 2009
LATEST

The easiest way is:

<cfmail type="html"

etc

>

<cfdump var="#form#">

</cfmail>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources