I'm trying to send an email via adb shell.
my command is:
adb shell -a android.intent.action.SEND --es android.intent.extra.SUBJECT 'important!' --es android.intent.extra.TEXT 'hi everyone...' --es android.intent.extra.EMAIL 'rrr#bbb.co'
when running this command, a new email window indeed opened and the fields 'body' (TEXT) and 'subject' (SUBJECT) are full. but the field 'To:' is empty.
maybe something with that the type of 'subject' and 'body' fields is: android.widget.EditText and 'To:' is: android.widget.MultiAutoCompleteTextView
ok after few days searching the internt (I posted this question when I was realy despirated) I found a solution, tnx to
Using ADB to launch an activity while using putExtra
just use the option '-d rrr#bbb.co' and it will be fine!
Related
I use logrotate that sends me logs on a regular basis. My server is a VPS running Postfix as an outgoing-only SMTP server.
I would like all the mailed logs (which Logrotate sends) to be encrypted with PGP or S/MIME. How can I do that?
I searched for logrotate mail encryption, but couldn't find any. Therefore, I'm thinking that I can pass "nomail" command in logrotate config, but then add in the "postscript" a script to first encrypt the mail and then send.
So, is there a better way to encypt logrotate mail with PGP? Or that's what I need to do? I would appreciate any advise or an example of such a script.
Also, I'm not considering to use TLS as there are possible ways to bypass it in the SMTP server. And I would rather rely on encryption of individual messages.
Thanks!
Edit:
Here is my script I'm using for custom email sending(Without GPG for now):
#!/bin/bash
read MSG
echo $MSG | mail -s $1 $2
But when I force rotate with logrotate --mail=loggpg.sh --force /etc/logrotate.d/ufw I keep getting error about uncompression, do I need to manually uncompress it? Or there is smth wrong with the script?
Error I get:
error: mail command failed for /var/log/ufw.log.5.gz
error: uncompress command failed mailing /var/log/ufw.log.5.gz`
You can execute logrotate with --mail command line option. It will allow you to use your own shell/perl/python script to send email instead of default /bin/mail -s.
man logrotate
OPTIONS
...
-m, --mail
Tells logrotate which command to use when mailing logs. This command should accept two arguments: 1) the subject of the message, and
2) the recipient. The command must then read a message on standard input and mail it to the recipient. The default mail command is
/bin/mail -s.
I am trying to send an email to myself.
I have tried sudo apt-get install postfix mailutils followed by
mail -s "This is the subject" --append=FROM:myemail#gmail.com
Then i get:
To:
Cc:
...
I enter the info in the To and Cc spaces followed by pressing enter. But, then it just gives me empty space. I click enter and it just keeps giving me new lines. Then I click ctrl^C twice and it kills the email. I just want to send it.
Use Control-d to end it. Please see this Source https://linux.die.net/man/1/mail.
Make sure to add a relay host if you have one if the /etc/postfix/main.cf file
I'm debugging a problem with a script not emailing out.
When i execute the following outside of the script:
mail -s "testing" myemail#gmail.com
It just hangs. The terminal doesn't give me any feedback what it's doing or if it has finished. I can only enter a another command by CTRL + Cing it. Any ideas why? Sometimes it does work if I let it hang long enough (I will get an email about 2 - 4 minutes later).
I'm running CENTOS 5 something. I've just uninstalled sendmail and installed postfix to see if this fixes it and the same thing appears to be happening.
If you enter the above and hit it should take you to a blank line and wait for you to type the actual text of the message. Once you've completed entering the message, you enter a .<enter> (dot or period followed by enter key) as the first character on a line and (depending on the version), it will usually ask you to enter any CC: addresses. Hit again to proceed past that and it should then send the mail.
The above command doesn't actually send anything, the -s sets the subject, but unless you include a file it will simply wait for you to type something. If, on the other hand, you want it to just send something quickly you can have it pull in a file as the content of the message, e.g. mail -s "testing" myemail#gmail.com < some_text_file. This will read some_text_file into the body of the email and send it immediately.
I am trying to run MOSS on my Mac OS X and I don't know what mistake I am making. I am not sure whether I am running the command properly or not. I downloaded this file as 'moss', gave this execution permissions and tried to run following:
./moss -l python -c "Assignment 1" -d assignment1/
I got the response as
Checking files . . .
OK
Which is wrong. The assignment1 directory has 4 python scripts. Two files are exactly similar, in one I have rearranged the code and in another I have changed the variable names.
I have sent the email for registration and I have not received any reply. So I am running the code with default user ID.
I also tried running it with sending each of those python files instead of working on a directory, still I get same response.
./moss -l python -c "Assignment 1" 1.py 2.py 3.py 4.py
Steps to get going with MOSS on your Mac:
Send an email at moss#moss.stanford.edu with the mail body containing the email you want to register.
Eg:
registeruser
mail "username#domain" <-- your email
You will then get a reply containing the script that you will need to save as “moss.pl”. Just make sure that your Mac has the “perl” folder within the “/usr/bin/“ folder. Else, change the path of the perl folder on the very first line of the script to be compatible to your machine.
Now set the execute permission using the command “chmod ug+x moss.pl”. This should allow you to send your queries to the Stanford server. If you were to not execute this command then you may be denied the permission to submit any queries.
Now submit the query to the server using the command similar to the following (note the command is not restricted to a single flag (i.e. -l)….refer the comments in the script for USAGE instructions):
“./moss.pl -l python file_1.py file_2.py”
The result on submitting a query such as above would be:
Checking files . . .
OK
Uploading file_1.py ...done.
Uploading file_2.py ...done.
Query submitted. Waiting for the server's response.
http://moss.stanford.edu/results/282371307.
Just review if you have followed all the steps above. I, then, don't see you having any issues getting the results. Maybe you were facing issues bcoz you were not registered initially.
Seems one should be registered to use it, instructions weren't clear on the site. I received the email finally with userid and ran the script, this time it worked.
I think you should resend the email in the format:
registeruser
mail youremail
In the reply email you will get your ID, replace it in the script and run the moss file again. You should get the link for the result.
I need to a script that telnet to eagle STP device and run commands there.
When I try to telnet a eagle STP device from command prompt,
I am getting the below output :
[root#localhost tmp]# telnet hostname port
Trying hostname...
Connected to hostname hostname).
Escape character is '^]'.
I am not getting any prompt here to match in the perl script. We need to press control+a inorder to get the prompt.If we press control+a, it will give the below output
[root#localhost tmp]# telnet hostname port
Trying...
Connected to hostname.
Escape character is '^]'.
>
Then we need to enter login:uid at this prompt
> login:uid=dumps
Then it prompts for a password
Enter password : password
then again we need to press control+a again to execute the commands.
> rtrv-dstn.
I am struck here , I am unable to pass control+a command after telnet command.
I wrote the script in the below way. But it is not working. Can ANY ONE HELP ME !!!!
#!/usr/bin/perl
use Net::Telnet;
my $host='hostname';
my $port='port';
my $telnet = new Net::Telnet(Host => $host, Port => $port, Timeout => 20)
or die "connect failed: $!";
$telnet->open($host);
print"Hi iii";
$telnet->waitfor('+$/i');');
print"Hello";
$telnet->print("^]");
$telnet->waitfor('/>$/i');
$telnet->print("login:uid=username");
$telnet->waitfor('/Enter Password :\s+$/i');
$telnet->print("password");
$telnet->waitfor('/>$/i');
#res1=$telnet->print("rtrv-dstn");
print"#res1";
Exit;
From Net::Telnet:
print - write to object
This method writes #list followed by the output record separator to the open object and returns 1 if all data was successfully written. On time-out or other failures, the error mode action is performed. See errmode().
You can set the output_record_separtor via $telnet->ors("\x01"); or by using:
$telnet->cmd("\x01");
to send a Ctrl-A when you need it. Don't have an Eagle STP for testing, but I hope this helps.
By the way, you should always check the output of each method call to make sure it works.
I dont have your device to try out, but you could try to use the metasymbols and send "\cA" for CTRL-A:
$telnet->print("\cA");
Also ^] is used by the local telnet client to escape sequences not sending them directly to the server, so i suppose it has no use here.
$telnet->print("\cA") will not likely work as it also sends a trailing newline. Use put() to send chars without the trailing newline e.g. $telnet->put("\cA");