CFPOP Command unrecognized "USER" cant use
Description
Environment
Lucee 5.1 with NGINX in MAC OS x - El Capitan 10.11.4
Attachments
- 29 Nov 2016, 04:30 pm
Activity
Javier Roque 29 November 2016 at 18:51
Sure, this is the tag used for calling headers:
<cfpop action="getheaderonly" name="get_emails" server="#client.mail_server#"
username="#client.username#" password="#client.password#" timeout="1200">
Igal Sapir 29 November 2016 at 17:53
Can you please post your CFML code for cfpop (hiding of course any sensitive information)?
Javier Roque 29 November 2016 at 16:32
Again, work arounds have been found, as for example using java directly, but things arent supposed to be this complicated I believe.
<cfset javaSystem = createObject("java", "java.lang.System") />
<cfset jProps = javaSystem.getProperties() />
<cfset jProps.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory") />
<cfset jProps.setproperty("mail.pop3.port",995) />
<cfset jProps.setProperty("mail.pop3.socketFactory.port", 995) />
<cfset msession = createObject("java", "javax.mail.Session")>
<cfset m2 = msession.getDefaultInstance(jprops)>
<cfset store = m2.getStore("pop3")>
<cfset store.connect("pop.gmail.com","themail@gmail.com","thepassword")>
<cfset df = store.getFolder("INBOX")>
<cfset df.open(df.HOLDS_MESSAGES)>
<cfset msgs = df.getMessages()>
With this, the session gets created directly and logs in.
now, by using the getMessages() method within the variable the I named "msgs" I can use any method that I need and populate the strings or any value to a new query object.
In this example I populated the query object that is created en <cfpop action="getheadersonly"....... > is used:
<cfset get_emails = queryNew("subject,from,MessageNumber,date", "varchar,varchar,int,date")>
<cfloop index="i" from = "1" to = "#df.getMessageCount()#">
<cfscript>
queryAddRow(get_emails);
querySetCell(get_emails, "subject", "#msgs[i].getSubject()#");
querySetCell(get_emails, "from", "#msgs[i].getFrom()[1].toString()#");
querySetCell(get_emails, "MessageNumber", "#msgs[i].getMessageNumber()#");
querySetCell(get_emails, "date", "#msgs[i].getSentDate()#");
</cfscript>
</cfloop>
If get_emails is dumped, a query object with the same properties as the cfpop tag "getheadersonly" will be shown, and better yet, if you need to add any other thing to the query object you may use any of the methods in the "msgs" function too right there to simplify things.
Details
Assignee
Igal SapirIgal SapirReporter
Javier RoqueJavier RoquePriority
MajorNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Details
Details
Assignee
Reporter
Priority
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Firing <CFPOP> tags has not been working in this environment, research done shows that other users are able to use it properly. Perhaps it's a Mac OS exclusive error. (Wouldn't surprise me to be honest.)
Complete java stack trace shown in attachment: