Help please!
I need to post some text data to an e-mail adress or web site form using s4la python how can i do that(without opening e-mail client)?
Just to be clear: This will be a "webshop tool" that reads info from a qr code and sent it to the webshop. Just read a code and read an "ordered amount" and send them.
why python? Becouse thats the only one i can use. :)
To send your data to a website, look at the file weather.py
This file is provided as example when you install python.
http://code.google.com/p/android-scripting/source/browse/python/ase/scripts/weather.py
it uses the module urllib2
interesting part of the file:
WEATHER_URL = 'http://www.google.com/ig/api?weather=%s&hl=%s'
url = WEATHER_URL % (urllib.quote(location), hl)
handler = urllib2.urlopen(url)
data = handler.read()
You can use smtplib if you want to connect to an SMTP server like Google.
To send use:
msg = MIMEMultipart()
msg['Subject'] = 'Our Subject'
msg['To'] = 'receiver#host.net'
msg['From'] = 'sender#gmail.com'
msg.attach(MIMEText(body, 'plain'))
smtpObj = smtplib.SMTP(smtp_server,smtp_port)
smtpObj.starttls()
smtpObj.ehlo()
smtpObj.login(username,password)
smtpObj.sendmail(username,to_addr,msg.as_string())
smtpObj.close()
Related
I am using the nuget example for Azure Cognitive services.
The code works fine when sending a sample image as below. But when taking photo and storing it on Android as below it crashes.
Is there any difference in using the paths? Is it somthing with Android access to folder?
Probably something obvious but cannot solve it?!
urlFile - OK
urlFile string = https://intelligentkioskstore.blob.core.windows.net/visionapi/suggestedphotos/3.png
urlFile-Crash
urlFile string = /storage/emulated/0/Android/data/com.companyname.ocr/files/Pictures/Sample/bild_13.png
Azure call
var textHeaders = await client.ReadAsync(urlFile, language: "en");
Crash text
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ComputerVisionOcrErrorException: 'Operation returned an invalid status code 'BadRequest''
I try to send the user key in String to onine server and make request, but it just send the string before the symbols. Any idea how to make Android read through but not remove the symbols? I mean all the symbols.
The following method is replace the [space] so the PHP can read my link
String sText = ""+autoTv.getText().toString().replace(" ","%20")+"";
SearchRequest t = new SearchRequest();
t.execute(sText);
I am calling a web service through async task which is returning text in strange format. here is sample string
dhmot_enot = Ï. ÎÎ®Î¼Î¿Ï ÎοÏλαÏ
zoe_name = Î.Î.Î: ÎÏÎ½ÎµÏ Î ÏοÏÏαÏÎ¯Î±Ï ÎÏοÏÏ Î¥Î¼Î·ÏÏοÏ
zones_zoe = ÎΩÎÎ Î: ÎÎ ÎÎΥΤΠΠΡÎΣΤÎΣÎΠΤÎΣ ΦΥΣÎΣ
zoe_fek = 187/Î/2011
fek_rel = 544/Î/1978
yphresia = Î¥.ÎÎÎ Î. ÎάÏηÏ-ÎοÏλαÏ-ÎοÏλιαγμÎνηÏ
How to find and resolve this ?
Update 1
Here is the actual service link that i am calling from server (works well in web browser ) but when i call from android it looks like above
http://geo-polis.gistemp.com/geoserver/wms?service=WMS&version=1.1.1&srs=EPSG:4326&bbox=23.733829893171787,37.75098946973509,23.839769437909126,37.89294194933182&styles=&&buffer=20&OUTPUTFORMAT=json&request=GetFeatureInfo&layers=geopolis:oria_eniaiou_dhmou&query_layers=geopolis:oria_eniaiou_dhmou&width=1080&height=1832&x=690&y=821
The response is a normal UTF-8 encoded stream of data. To see this, go to the URL you show in your post in the browser, and look at the encoding it picked automatically: it'll show unicode/utf-8 as character encoding for the response. If you change that, forcing the browser to decode it as if it's ANSI encoded (windows codepage 1252/ISO-8859-15) then the text turns into the gibberish you were showing in your question, so: you're not decoding the data correctly, and need to make sure to decode as utf8.
Using flash builder I have developed an app for both android and IPhone. I would like to be able to open the default email client on the phone and send an email with an attachment. I have seen many examples using "mailto:" however this is not supported with an attachment. I have googled this extensively and have found nothing that is current with in the last 3 years.
I already make the pdf file I wish to attach and can move it to a temp directory if needed to satisfy the access issue. I would like to use the default mailer like other programs use if that is not doable please tell me how to directly send an email from the app.
Just for reference to help expand the Action Script 3.0 Information base. I was unable to find any way to do what I was asking above. Here is the Method that I used to send email with attachment.
https://code.google.com/p/airxmail/
http://flex.coltware.com/as3-flex-air/airxmail/
import com.coltware.airxmail.INetAddress;
import com.coltware.airxmail.MailSender.SMTPSender;
import com.coltware.airxmail.MimeMessage;
import com.coltware.airxmail.RecipientType;
private function send_plain_email():void{
// How to send plain text email
var sender:SMTPSender = new SMTPSender();
sender.setParameter(SMTPSender.HOST,"your.smtp.hostname");
sender.setParameter(SMTPSender.PORT,25); // default port is 25
// If you use SMTP-AUTH
sender.setParameter(SMTPSender.AUTH,true);
sender.setParameter(SMTPSender.USERNAME,"username");
sender.setParameter(SMTPSender.PASSWORD,"password");
// Create email message
var message:MimeMessage = new MimeMessage();
// Set from email address and reciepients
var from:INetAddress = new INetAddress("from-email-address#xxxx.yyyy","from label");
message.setFrom(from);
var toRecpt:INetAddress = new INetAddress("to-email-address#xxxx.yyyy","to label");
message.addRcpt(RecipientType.TO,toRecpt);
var ccRecpt:INetAddress = new INetAddress("cc-email-address#xxxx.yyyy","cc label");
message.addRcpt(RecipientType.CC,ccRecpt);
//
message.setSubject("hello world");
//
// Plain Text Part
//
var textPart:MimeTextPart = new MimeTextPart();
message.setSubject("Reciept for #" + job.jobs.JobID);
textPart.contentType.setParameter("charset","UTF-8");
textPart.transferEncoding = "8bit";
textPart.setText("Please see attached PDF \n You will need a PDF viewer to open \n To download the latest version of Adobe Acrobat reader, Please follow the link: http://www.adobe.com/products/acrobat/readstep.html");
message.addChildPart(textPart);
//
// Attachment part
//
var filePart:MimeImagePart = new MimeImagePart();
filePart.contentType.setMainType("application");
filePart.contentType.setSubType("pdf");
filePart.setAttachementFile(File.desktopDirectory.resolvePath(sfile),"WorkOrder.pdf");
message.addChildPart(filePart);
sender.send(message);
sender.close();
}
Hi i have web application which uses mailto like
Send email
but no meter what i do it alway replace space with + sign
Try to decode your String
just use Uri.encode(String).
subject = (EditText) findViewById(R.id.subject);
subject.setText(Uri.encode(WhatEverYourStringVarIs));
This will help you to decode the URIencode.
If you mean the PHP (HTML) Issue just do the same:
$encodeString = urlencode($encodeString);
echo $encodedString;
So the String will displayed proper.
See this url encode.
Okay, but when i'm read your Question the third time: You can use Spaces in these HTML case. It is an Android Bug. Just use this:
Send Mail