imap error after received Gimap ready for requests - imap

I have an error when i run the code.
the following is the code:
void smtp_listener::imapLogin(QString reply)
{
print_D(FUNC);
print_D(QString("this is "+reply+"well"));
if(reply.contains("OK"))
{
QString msg = QString("user %1").arg(user);
print_D(msg);
*t << msg <<"\r\r\n";
t->flush();
setState(POP3_Pass);
}
else
{
print_E("ERROR :"+reply,FUNC,__LINE__);
quitConn();
setState(POP3_Quit);
}
}
void smtp_listener::pop3Pass(QString reply)
{
print_D(FUNC);
print_D(QString("this is "+reply+" well"));
if(reply.contains("+OK"))
{
QString msg = QString("pass %1").arg(pass);
*t << msg <<"\r\n";
t->flush();
setState(POP3_Stat);
}
else
{
print_E("ERROR :"+reply,FUNC,__LINE__);
quitConn();
setState(POP3_Quit);
}
}
the error i give after i debug:
[Debug] "Email account : connected."
[Debug] "void smtp_listener::imapLogin(QString)"
[Debug] "this is * OK Gimap ready for requests from 140.101.159.251
q2-v6mb85227685wrd
well"
[Debug] "user chairouyih#gmail.com"
[Debug] "void smtp_listener::pop3Pass(QString)"
[Debug] "this is user BAD Unknown command q2-v6mb85227685wrd
well"
"[Error] ERROR :user BAD Unknown command q2-v6mb85227685wrd
at func=void smtp_listener::pop3Pass(QString) Line=361"
[Debug] "void smtp_listener::quitConn()"
[Debug] "void smtp_listener::pop3Quit(QString)"
[Debug] "* BAD invalid tag q2-v6mb85227685wrd

You are using POP3 commands with an IMAP server. They are not compatible, and their language is very different.
For one, every IMAP command has a tag, and basic logging in is done with a LOGIN command. It would look something like this:
a001 LOGIN user#gmail.com "password"
If you want to use POP3, connect to the pop3 server at pop.gmail.com, with TLS enabled on port 995.

Related

PHPMailer dev-xoauth failed authentication

So I've gone through all of the docs on github - phpmailer xoauth tree to set up my scripts accordingly to use Google's oauth2. I am trying to send an email from the form at halcyonco.io to myself. The domain name is just to live test this site. I encounter the same error when sending the form locally.
My question is when I submit the form I receive this error:
SERVER -> CLIENT: 220 mx.google.com ESMTP pj4sm27148656pbb.29 - gsmtp
CLIENT -> SERVER: EHLO halcyonco.io
SERVER -> CLIENT: 250-mx.google.com at your service, [68.65.121.206]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
CLIENT -> SERVER: EHLO halcyonco.io
SERVER -> CLIENT: 250-mx.google.com at your service, [68.65.121.206]
250-SIZE 35882577250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN XOAUTH
250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING
250 SMTPUTF8
SMTP Error: Could not authenticate.
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 2.0.0 closing connection pj4sm27148656pbb.29 - gsmtp
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I have been in touch with Namecheap as I have my hosting and domains through them but after an hour and half they could not help me.
Below is my contact.php script
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = trim($_POST["user_name"]);
$email = trim($_POST["user_email"]);
$comment = trim($_POST["comment"]);
if ($name == "" OR $email == "" OR $comment == "") {
echo '<h3>Please fill out all forms.</h3>';
exit;
}
// SPAM protection
foreach ($_POST as $value) {
if ( stripos($value, 'Content-Type') !== FALSE ) {
echo "There was a problem with the information you entered.";
exit;
}
}
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('America/New_York');
require '../vendor/phpmailer/phpmailer/PHPMailerAutoload.php';
//Load dependnecies from composer
//If this causes an error, run 'composer install'
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailerOAuth;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Set AuthType
$mail->AuthType = 'XOAUTH2';
//User Email to use for SMTP authentication - Use the same Email used in Google Developer Console
$mail->oauthUserEmail = "myemail#gmail.com";
//Obtained From Google Developer Console
$mail->oauthClientId = "1234567890.apps.googleusercontent.com";
//Obtained From Google Developer Console
$mail->oauthClientSecret = "123456789";
//Obtained By running get_oauth_token.php after setting up APP in Google Developer Console.
//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
// eg: http://localhost/phpmail/get_oauth_token.php
$mail->oauthRefreshToken = "1/ABCD12345EFGH6789";
//Set who the message is to be sent from
//For gmail, this generally needs to be the same as the user you logged in as
$mail->setFrom($email, $name);
//Set who the message is to be sent to
$mail->addAddress('myemail#gmail.com', 'Brandon Smith');
//Set the subject line
$mail->Subject = 'Promethean Fitness Enquiry | ' . $name;
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML = $comment;
//Replace the plain text body with one created manually
$mail->Body = $comment;
$mail->AltBody = $comment;
//Attach an image file
//send the message, check for errors
if (!$mail->send()) {
echo '<h3>Please ensure you have entered a correct email address.</h3><br>';
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
header("Location: ../html/thanks.html");
exit;
}
//This is a spam protection
if ($_POST["user_address"] != "") {
echo "Your form submission has an error";
exit;
}
}
?>
Any help on what I need to do in order to fix this would be great.

Push notification missing messages

I am following the tutorial from this website:
https://blog.engineyard.com/2013/developing-ios-push-notifications-nodejs
to deliver push Notification in my app.
I have successfully created the certificate and other files so far. In the server side, I couldn't pass through the Making the Connection step.
I can get my device token in console while running the app. In the tutorial it is said that, after making the connection the Terminal console should give a output as "gateway connected".
But I am not getting this message. The worst case is I am not getting any error message either. I wonder what went wrong. Even though I got some errors in making the connection first like insufficient credentials, mac verify error, I solved those. Now am neither getting any error nor the correct message.
I also add my Terminal console here
SIVAs-MacBook-Air:~ AAA$ cd Desktop/
SIVAs-MacBook-Air:Desktop AAA$ cd poservices/
SIVAs-MacBook-Air:poservices AAA$ node agent/_header.js
SIVAs-MacBook-Air:poservices AAA$ node agent/_header.js
SIVAs-MacBook-Air:poservices AAA$`
var join = require('path').join
, pfx = join(__dirname, '../_certs/pfx.p12');
/*!
* Create a new gateway agent
*/
var apnagent = require('apnagent')
, agent = module.exports = new apnagent.Agent();
/*!
* Configure agent
*/
agent
.set('pfx file', pfx)
.enable('sandbox');
/*!
* Error Mitigation
*/
agent.on('message:error', function (err, msg) {
connect.log('error1');
switch (err.name) {
// This error occurs when Apple reports an issue parsing the message.
case 'GatewayNotificationError':
console.log('[message:error] GatewayNotificationError: %s', err.message);
// The err.code is the number that Apple reports.
// Example: 8 means the token supplied is invalid or not subscribed
// to notifications for your application.
if (err.code === 8) {
console.log(' > %s', msg.device().toString());
// In production you should flag this token as invalid and not
// send any futher messages to it until you confirm validity
}
break;
// This happens when apnagent has a problem encoding the message for transfer
case 'SerializationError':
console.log('[message:error] SerializationError: %s', err.message);
break;
// unlikely, but could occur if trying to send over a dead socket
default:
console.log('[message:error] other error: %s', err.message);
break;
}
});
/*!
* Make the connection
*/
agent.connect(function (err) {
// gracefully handle auth problems
if (err && err.name === 'GatewayAuthorizationError') {
console.log('Authentication Error: %s', err.message);
process.exit(1);
}
// handle any other err (not likely)
else if (err) {
console.log('error1');
throw err;
}
// it worked!
var env = agent.enabled('sandbox')
? 'sandbox'
: 'production';
console.log('apnagent [%s] gateway connected', env);
});
You need to add
agent.set('passphrase', '<YOUR_PASSWORD>');
after
agent.set('pfx file', pfx).enable('sandbox');

trigger.io iOS Facebook apprequests incorrect parameter quotation

I'm making an apprequests using native Facebook plugin as follows:
forge.facebook.ui(
{
method: "apprequests",
title: "How well do you know your friends?",
message: "Play this friends guessing game with me. This is just like the game Guess Who with Facebook.",
to: 100005076427220
},
function(response) {
alert('succ:' + JSON.stringify(response));
}, function(response){
alert('error:' + JSON.stringify(response));
}
);
On Android everything looks fine. Here is the debug output:
[ INFO] D/Forge (11035): Native call facebook.ui with task.params: {"method":"apprequests","title":"How well do you know your friends?","message":"Play this friends guessing game with me. This is just like the game Guess Who with Facebook.","to":100005076427220}
[ INFO] D/Forge (11035): Returned: {"content":{"to[0]":"100005076427220","request":"1404036919832397"},"callid":"39281D3C-EACE-4070-937C-3BE1852DA12F","status":"success"}
Unfortunately on iOS is not. Here is the debug output:
[DEBUG] Native call: {
[DEBUG] callid = "BF08EEC1-175D-483F-846B-319721A82B04";
[DEBUG] method = "facebook.ui";
[DEBUG] params = {
[DEBUG] message = "Play this friends guessing game with me. This is just like the game Guess Who with Facebook.";
[DEBUG] method = apprequests;
[DEBUG] title = "How well do you know your friends?";
[DEBUG] to = 100005076427220;
[DEBUG] };
[DEBUG] }
[DEBUG] 2013-10-30 15:53:53.283 Forge[732:907] -[__NSCFNumber UTF8String]: unrecognized selector sent to instance 0x1cdd9c20
[DEBUG] Returning to javascript: {
[DEBUG] callid = "BF08EEC1-175D-483F-846B-319721A82B04";
[DEBUG] content = {
[DEBUG] message = "-[__NSCFNumber UTF8String]: unrecognized selector sent to instance 0x1cdd9c20";
[DEBUG] type = "UNEXPECTED_FAILURE";
[DEBUG] };
[DEBUG] status = error;
As you can see, the parameter method = apprequests; is not quoted as it is in Android
method = "apprequests"; It is not from my code but from the public plugin itself.
Is it possible that this makes the error?
I'm using Platform version v2.0.3 and Facebook module v2.0.1

Trigger.io sencha doesn't load on iOS

I am stuck on a blank white screen while loading Trigger.io iOS with Sencha 2.
It works fine on Android, but on iOS, it just shows a blank white screen.
Here's the debug output:
[INFO] 943E7E1BD31/Library/Application%20Support/Forge/assets-AA20D894-4614-43FB-BE67-D78F05175E9B/src/index.html
[DEBUG] Returning to javascript: {
[DEBUG] event = \"internal.connectionStateChange\";
[DEBUG] params = {
[DEBUG] connected = 1;
[DEBUG] wifi = 1;
[DEBUG] };
[DEBUG] }
[DEBUG] Native call: {
[DEBUG] callid = \"C812FD5E-EFAE-4BCD-A3EE-CFB2574F70EA\";
[DEBUG] method = \"internal.hideLaunchImage\";
[DEBUG] params = {
[DEBUG] };
[DEBUG] }
[DEBUG] Returning to
[DEBUG] script: {
[DEBUG] callid = \"C812FD5E-EFAE-4BCD-A3EE-CFB2574F70EA\";
[DEBUG] content = \"<null>\";
[DEBUG] status = success;
[DEBUG] }
After hiding launch image, it's calling content = \"<null>\"; ?
It turns out Sencha 2 has a bug, it was throwing an error like this:
Error: [ERROR][Ext.viewport.Ios#undefined] Timeout waiting for window.innerHeight to change
I did some research, and it seems to be a bug relating to Safari vs. UI Web View.
To solve this problem, add this under Ext.application({
viewport: { autoMaximize: false },
Cheers

Connection timeout with HttpURLConnection in Groovy

I am always getting the "Error Connecting to ${url}" message?
Can anyone please show me my mistake?
def url = new URL("https://www.google.com")
HttpURLConnection connection = (HttpURLConnection) url.openConnection()
connection.setRequestMethod("GET")
// connection.setConnectTimeout(10000)
connection.connect()
if (connection.responseCode == 200 || connection.responseCode == 201) {
def returnMessage = connection.content
//print out the full response
println returnMessage
} else {
println "Error Connecting to " + url
}
| Error 2012-07-05 00:04:05,950 [http-bio-8080-exec-6] ERROR errors.GrailsExceptionResolver - ConnectException occurred when processing request: [GET] /CopperApplications/urlTracker Connection timed out: connect. Stacktrace follows: Message: Connection timed out: connec
Your code seems correct, and produces the expected(?) results on Groovy 1.7.9 with 1.6.0_33 JVM. There is likely something amiss with your network (as indicated by the connection timeout error).

Resources