[TUTORIAL] unread mail count tasker all mail clients (imap) - Android General

No idea where to put this, admin; feel free to move or delete.
There's a lot of really cool custom theming going on with Android and an often important part of that is the visual indication of missed phone calls, new messages, new mail, etc. (unread bubbles next to app icons, in lockscreens, etc.). There's a host of solutions to get this info but for me e-mail counts had always been a bit of a issue. Missed phone calls are tracked by the Android system, and WhatsApp notifications can be counted from the notification bar with Tasker and reset when you open the app because your phone is the only place where you will check your WhatsApp messages. E-mail however is not centralized in Android (yet) so if you use anything else than Gmail the system won't know how many unread mails you have and you could uee a notification counter on your mail app but when a new email arrives it will put the counter on +1, if you then read the e-mail on another device (for example your computer) your notification counter on your phone will still be on +1 even though you read the mail.You then have to open your mail app to get the counter back to 0 again.
That why I made this PHP / Tasker solution for my IMAP mail. This is a PHP script that checks how many unread mails there are in your inbox:
PHP:
<?php
function mailCount($host, $login, $passwd) {
$mbox = imap_open($host, $login, $passwd);
$mail = '';
if($mail = imap_check($mbox)) {
$msgnos = imap_search($mbox, 'UNSEEN');
return $msgnos;
}
}
$hostname = '{imap.yourhost.com:143/imap}INBOX';
$username = 'your_username';
$password = 'your_password';
$count = mailCount($hostname, $username, $password);
if ($count != "") $number = sizeof($count);
else $number = 0;
echo $number;
Change yourhost, your_username and your_password and the port (143). (if you want to, add some extra security by doing IP or Cookie checks), put the PHP file online on your server. The script will then simply show a number of unread mails in your inbox.
Then you can use Tasker to read this number. Add a tasks (for example CheckMailCount) then add the action Net > HTTP Get. For 'Serverort' fill in the url of your script (http://www.yourserver.com/unreadmail.php) and set the Mime Type to 'text/*'. Then in the same task add an action Variables > Variable Set. Give the variable a Name (for example: %MAILCOUNT) and set it To %HTTPD. This will set the %MAILCOUNT variable to the result of the last http Get request ie. the number of unread mails.
You now have a tasker variable with the actual number of unread mails in your inbox.
I use this on my WidgetLocker lockscreen so I trigger the task on Event > Display > On. I added a third action in the CheckMailCount action to set a Zooper Variable (Plugin > Zooper Widget Pro >Edit > ZW Variable = MAILNOTI, ZW Text = %MAILCOUNT) you could also make this %HTTPD straight away if you don't use the variable for anything else. You then have the #TMAILNOTI# variable in Zooper to use to display how many unread mails you have in a widget. I don't use the count but I display a mail icon indicating that I have a new mail if the #TMAILNOTI# is anything but 0. I do this by adding a bitmap in Zooper of a mail icon and then in Avanced Parameters I put
$#TMAILNOTI#=0?/sdcard/icons/nomail.png$
This tells Zooper that if the variable #TMAILNOTI# = 0 it should use the bitmap nomail.png in my icons folder on the sd card. nomail.png in my case is simply an empty transparent png.
Hope this helps somebody!

nielshtc said:
No idea where to put this, admin; feel free to move or delete.
There's a lot of really cool custom theming going on with Android and an often important part of that is the visual indication of missed phone calls, new messages, new mail, etc. (unread bubbles next to app icons, in lockscreens, etc.). There's a host of solutions to get this info but for me e-mail counts had always been a bit of a issue. Missed phone calls are tracked by the Android system, and WhatsApp notifications can be counted from the notification bar with Tasker and reset when you open the app because your phone is the only place where you will check your WhatsApp messages. E-mail however is not centralized in Android (yet) so if you use anything else than Gmail the system won't know how many unread mails you have and you could uee a notification counter on your mail app but when a new email arrives it will put the counter on +1, if you then read the e-mail on another device (for example your computer) your notification counter on your phone will still be on +1 even though you read the mail.You then have to open your mail app to get the counter back to 0 again.
That why I made this PHP / Tasker solution for my IMAP mail. This is a PHP script that checks how many unread mails there are in your inbox:
PHP:
<?php
function mailCount($host, $login, $passwd) {
$mbox = imap_open($host, $login, $passwd);
$mail = '';
if($mail = imap_check($mbox)) {
$msgnos = imap_search($mbox, 'UNSEEN');
return $msgnos;
}
}
$hostname = '{imap.yourhost.com:143/imap}INBOX';
$username = 'your_username';
$password = 'your_password';
$count = mailCount($hostname, $username, $password);
if ($count != "") $number = sizeof($count);
else $number = 0;
echo $number;
Change yourhost, your_username and your_password and the port (143). (if you want to, add some extra security by doing IP or Cookie checks), put the PHP file online on your server. The script will then simply show a number of unread mails in your inbox.
Then you can use Tasker to read this number. Add a tasks (for example CheckMailCount) then add the action Net > HTTP Get. For 'Serverort' fill in the url of your script (http://www.yourserver.com/unreadmail.php) and set the Mime Type to 'text/*'. Then in the same task add an action Variables > Variable Set. Give the variable a Name (for example: %MAILCOUNT) and set it To %HTTPD. This will set the %MAILCOUNT variable to the result of the last http Get request ie. the number of unread mails.
You now have a tasker variable with the actual number of unread mails in your inbox.
I use this on my WidgetLocker lockscreen so I trigger the task on Event > Display > On. I added a third action in the CheckMailCount action to set a Zooper Variable (Plugin > Zooper Widget Pro >Edit > ZW Variable = MAILNOTI, ZW Text = %MAILCOUNT) you could also make this %HTTPD straight away if you don't use the variable for anything else. You then have the #TMAILNOTI# variable in Zooper to use to display how many unread mails you have in a widget. I don't use the count but I display a mail icon indicating that I have a new mail if the #TMAILNOTI# is anything but 0. I do this by adding a bitmap in Zooper of a mail icon and then in Avanced Parameters I put
$#TMAILNOTI#=0?/sdcard/icons/nomail.png$
This tells Zooper that if the variable #TMAILNOTI# = 0 it should use the bitmap nomail.png in my icons folder on the sd card. nomail.png in my case is simply an empty transparent png.
Hope this helps somebody!
Click to expand...
Click to collapse
This looks way to confusing but I get it a little bit... lets say I want to use UCCW tasker variable option to show the counts...:silly:

Related

Text Replacement App

I was wondering if anyone has created or know of an app that does text replacement similar to the blackberry text replacement program.
Ie: when your typing a text and you press "u" and then press space, it will replace it with "You".
This would have smartcase enabled, and will allow people to enter in thier own custom words and macros.
Ie:
goog = google.com
u = you
ur = your
bb = blackberry
droid = motorola droid
fb = facebook
tw = twitter
gc = google chat
*date* = inserts current date
*#* = inserts phone #
The list could keep going on and on.
+1 that would be lots of help
ultra keyboard does this
just checked "ultra keyboard" it does not support both physical keyboard/touch screen keyboard.
It also does not have a user defiend entries, that if I press the space bar twice, it wont auto change the word im looking for. .such as:
I type:
I sent you a msg on fb.
It would correct it to say:
I sent you a message on facebook.

Add-on Menu add-on to 'Create Meeting with a Contact'

I have searched and searched but not found anything that is suitable.
I am looking for a menu add-on or context menu that will allow me to:-
Create a calendar appointment/meeting request with a contact that does not have email address so cannot use the meeting request as an attendee.
i.e. 'Create Meeting With':
The new appointment would have the subject and location fields populated from the contact Name, default number and default Address.
I have seen this functionality in Agenda One and partially in the MS Powertoy cntctool.exe(copies the contact name and address to the appointment notes if no email address exists).
Ideally I do not want to install a completely new Calendar app like AgendaOne for this 1 piece of functionality so does anyone know of an alternative for an add-on to achieve this??
The code(I guess) would be along the lines of...
Appointment newappoinment = new Appointment();
newappoinment.Subject
="Meet with"contactPicker.SelectedContactName,
"("contactPicker.SelectedContactNumber")";
newappoinment.Location = contactPicker.SelectedContactAddress;
newappo inment.Start = DateTime.Now;
newappoinment.Duration = new TimeSpan(01, 00, 00);
newappoinment.ReminderVibrate = true;
newappoinment.ReminderSound = true;
newappoinment.ReminderRepeat = true;
newappoinment.ReminderSet = true;
using (OutlookSession session = new OutlookSession())
{
session.Appointments.Items.Add(newappoinment);
session.Dispose();
}
MessageBox.Show("Meeting Added");
Many thanks for anyone who can help,
Mick

[Req] SMS template app

Hi. I was wondering if there is any program that does the following: When you click on a shortcut it will pop up the new message user interfece with the "To" box prefilled by some number(s) and the msg box also prefilled by some text (see the attached picture) and the cursor is after that text. So you may add additional text if you want before you press send. The predefined numbers and msg are obviously configurable.
One example of the use is that, say you send a twitter direct msg to someone regularly using an sms service (not a twitter app which requires internet). Then you can prefilled the "To" box with the twitter number and the msg box with "D username ". So you can add the msg you want after D username and press send. (I often forgot to write "D username" which results in my msg sent to all my followers, LOL)
I did some search and found some apps like GroupSMS, PowerSMS. But none of these does what I just described. Some have a schedule SMS feature which you can send a specific msg to specific number(s) at a specific time, but I want to have some control (e.g. adding more msg) before I send it.
Thanks and sorry for the long explanation

[Q] tmail parameter help

I've looked all over without finding what I'm looking for, I've also tried many many param lines but can't make it work??
I want to set a tmail param to take me to a unread sms instead of my inbox. This Parameter:
Code:
\Windows\tmail.exe -service "SMS"
This takes me to my inbox but I want to be able to go to the new sms when received like Win does it in its lockscreen...

[Q] Sending tray notifications by grabbing from a URL. Any examples?

I am very new to this, and have no programming background. I had someone code my app for me, but I'd like to add another feature.
I basically want to call upon a URL with the device's UUID every 15 minutes (example.com/notify.php?uuid=XXX), it will return true or false (based on if they've received the notification), if it returns true... it will return with a json.. the info in the json will be text and url. The text will be the text of the notification that will appear in the status tray (when they pull down), and the URL will be the URL it will go to when they click on it.
This is going to be used to send announcements regarding my app. Anyone have any examples on how to do this? I have basic programming (PHP) so I can change some things.

Categories

Resources