I was testing the cfmail tag within coldfusion and kept refreshing the page and now my email is being spammed consistently with the same code that I wrote in the file. I tried to delete the file but my email keeps getting spammed with the code.
this isnt my real email but this is what I did pretty much. I tried deleting the file to stop the infinite email loop but I keep getting spammed in my email.
<cfmail to="myemail"
from="myemail"
subject="myemail"
type="text">
Dear myemail
We, here at Bedrock, would like to thank you for joining.
Best wishes
Barney
</cfmail>
<cfoutput>
<p>Thank you test for registering.
We have just sent you an email.</p>
</cfoutput>
Related
I recently started learning coldfusion. I am getting a bit confused, reading through numerous websites regarding the function cfhttp.filecontent.
Can any of you help me understand and provide me with an example of how I would format the following code I am writing? I am already grabbing name and email from a form on the index page and trying to initiate an API request and get the password back, formatted correctly.
<cfset passwordcomplexity = 4>
<cfinclude template='header.cfm'>
<cfhttp method="GET" url="https://hardest.pw/api/#passwordlenght#/#passwordcomplexity#">
<cfset returnString = cfhttp.filecontent>
<cfdump var="#returnString#">
<!---<cfmail to="#form.email#"
from="no-reply#training-pavel.com"
subject="New random password"
type="text">
Hey there, #form.name#!
We've just generated a new password for you! You can see it below:
</cfmail>--->
<cfinclude template='footer.cfm'>
At the end I just get something like this:
{"code":200,"desc":"Command completed successfully","password":"[&Vo4%T#l8","hardestlink":"https:\/\/hardest.pw\/0758828a-a6f6-4f9b-9bd7-c0dc778de0b7"}
I want to send a email to real gmail ID's to the end users. So I used smtp.gmail.com as mail server with my own email user name & password. But if I use this.smtpServersettings in my application.cfc it's not sending a email. All the mail's are went to undelivered options. My sample code,
App.cfc :
<cfset this.name='mailfn8'>
<cfset this.smtpServersettings={server:"smtp.gmail.com",username:"mygmail#gmail.com",password:"mypassword"}>
My.cfm :
<cfmail from='sender#gmail.com' to='receiver#gmail.com' subject='test' type='html' port="587" usetls="true">
I'm seding a email by using this.smtpServersettings options.
</cfmail>
But the credentials are working great in below scenario,
-- If I set my details in application scope and use that values in cfmail tag
-- Directly set it in coldfusion mail server setting
For example,
App.cfc :
<cfset this.name='mailfn8'>
<cffunction name='onApplicationStart'>
<cfset application.server='smtp.gmail.com'>
<cfset application.username='mygmail#gmail.com'>
<cfset application.password='mypassword'>
</cffunction>
My.cfm :
<cfmail from='sender#gmail.com' to='receiver#gmail.com' server= '#application.server#' username='#application.userName#' password='#application.password#' subject='test' type='html' port="587" usetls="true">
I'm seding a email by using application scope.
</cfmail>
The above working fine. So why this.smtpServersettings is send email to undelivered option instead of gmail. ? .Do I need to enable any other setting if I use this.smtpServerSetting ? Please help me on this. Correct me if I'm understood anything wrong. Thank you !.
The smtpServerSettings struct does not support port and usetls.
https://tracker.adobe.com/#/view/CF-4204467
My suggestion is to create your own struct in application scope then pass to cfmail tag with argumentCollection attribute.
I have a serious problem with jsessionid that is automatically pasted into my url. This extra value looks like this:
;jsessionid=5046392DAA8687BE348FB51B57B69DB3.cfusion
This is pasted into my url causing Page Not found error because it is pasted in the middle of url like this:
https://mycompany.com;jsessionid=5046392DAA8687BE348FB51B57B69DB3.cfusion/index.cfm?p=home&home=current
But this is only happening when I open the link in IE (mine is IE 11).
When I open it in FireFox or Chrome I don't get this problem. It normally shows up as:
https://mycompany.com/index.cfm?p=home&home=current
My link looks like this:
<a id="#url.home#" href="index.cfm?p=home&home=current" target="iframe_main">HOME</a>
But at home.cfm On top of the page I have:
<CFIF IsDefined("session.usergroup") AND session.usergroup EQ 0>
<CFLOCATION url="/index.cfm?p=home&form=current&loginerr=Your session is expired. Please re-login again">
<CFELSE>
show the page
</CFIF>
I tried using AddToken = "NO" attribute in the CFLOCATION. This will eliminate my problem in IE BUT I get a new problem. My session does not work!!
My Dep is switching to ColdFusion2016 and I'm working on this in CF2016.
Is there a way to fix this issue? please help, thank you!
When attempting to send an email to multiple recipients using ColdFusion, only the first row is receiving the email and it seems to be hit three times but only sending once. This works but all recipients are visible and the cfoutput is displayed as many times are there are recipients:
<cfmail
to = "#ValueList(getEmail.Schd_Email)#"
from="test#test.edu"
subject="This is a Test"
type="HTML"
query="getEmail"
failto="test#test.com">
The location has been moved to <b><cfoutput>#location#</cfoutput></b><br/>
</cfmail>
This only sends to the first person listed in the query and the cfoutput in the body is still listed as many times as there are recipients.
<cfmail
to = "#Schd_Email#;"
from="test#test.edu"
subject="This is a Test"
type="HTML"
query="getEmail"
failto="test#test.com">
The location has been moved to <b><cfoutput>#location#</cfoutput></b><br/>
</cfmail>
I can output the query to the page and see all emails listed. Not sure why the latter does not work. Any ideas?
I think you should use ';' delimiter in valueList(). the default delimiter for valueList() is ','. If you pass delimiter ';' it might work.
Try this one #ValueList(getEmail.Schd_Email,";")#
Since you are using the query attribute of the cfmail tag you do not need to use the ValueList() function. The query attribute handles that functionality for you. It also negates the need for using a delimeter between each of the "to" addressees. It should work like this assuming you have valid email addresses in your query results.
<cfmail
to="#getEmail.Schd_Email#"
from="test#test.edu"
subject="This is a Test"
type="HTML"
query="getEmail"
failto="test#test.com">
<div>The location has been moved to <b><cfoutput>#location#</cfoutput></b></div>
</cfmail>
I am getting the following error on a page we are loading:
coldfusion.runtime.CfErrorWrapper
Unable to add text to HTML HEAD tag.
[empty string]
caused by
Template
Unable to add text to HTML HEAD tag.
ColdFusion was unable to add the text you specified to the output stream. This is probably because you have already used a CFFLUSH tag in your template or buffered output is turned off.
I've done a sweep of all the files that are included in our application and cannot find anything that uses CFFlush.
output is set to 'no' on all cfcs and components. I also tried adding cfsetting showdebugoutput = no in a file. That didn't help.
I turned request debugging on in cfadmin and that didn't help.
The HTML Head works fine in other parts of our app, it just seems to be on this one page.
The only thing really different about this page is that it is a particularly long page.
If it's a particularly long page, then CF may be flushing the buffer on its own. If you check in the CFAdmin, on the settings page, there is a setting for Maximum Output Buffer size. I believe the default is 1024 KB. If your page is over 1 meg of content, then CF may flush the buffer before your <cfhtmlhead /> tag runs. Try increasing the buffer size, or changing the placement of the <cfhtmlhead /> tag to see if that corrects the issue.
I've run into the same problem recently but the behavior wasn't predictable. I believe that Dan Short's answer is correct. I created some test pages to see if I could reproduce the problem. Each time TestTemplate.cfm is included, CFHTMLHEAD writes a simple JavaScript alert to the head tag. Once the buffer is reached, and the page is automatically flushed, any subsequent CFHTMLHEAD tag use will result in an error, specifically, the error in the original post. As Dan indicates, you can work your way around this issue by changing the maximum output buffer size.
file: index.cfm
<html>
<head><title>Test Page</title></head>
<body>
<cfset SampleScript = "<script src='sample.js'></script>">
cfset Count = 0>
<cfinclude template="TestTemplate.cfm">
<cfinclude template="TestTemplate.cfm">
<cfinclude template="TestTemplate.cfm">
</body>
</html>
file TestTemplate.cfm
<cfhtmlhead text="#SampleScript#">
<cfset Count++>
<cfoutput>
<h1>Count #Count#</h1>
</cfoutput>
<cfoutput>
<cfloop from="1" to="100000" index="i">
<cfscript>
j = randRange(i, 1000000);
k = randRange(i, 1000000);
l = j * k;
writeOutput(l);
</cfscript>
</cfloop>
</cfoutput>
file sample.js
alert('Boo!');
server.log showed another error that I was submitting too many fields with a POST request. I had to increase this limit on the Settings page.
To fix this, login to Coldfusion Admin, go to Memory Variables, and uncheck 'Disable updating Coldfusion internal cookies using Coldfusion tags/functions.' Save your settings and restart your website.