Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Is there any framework that will allow me to send email without going through a GUI?
Add this framework to your project and then use my Swift class:
class EmailSender : SKPSMTPMessageDelegate {
private init() {}
static let sharedInstance = EmailSender();
func sendEmail(email : String, subject : String, message : String) {
let EMAIL_FROM = "test#gmail.com";
let EMAIL_PASS = "TestPassword";
let SMTP_SERVER = "smtp.gmail.com";
let EMAIL_TO = email;
let emailMessage = SKPSMTPMessage();
emailMessage.delegate = self;
emailMessage.fromEmail = EMAIL_FROM;
emailMessage.toEmail = EMAIL_TO;
emailMessage.relayHost = SMTP_SERVER;
emailMessage.requiresAuth = true;
emailMessage.login = EMAIL_FROM;
emailMessage.pass = EMAIL_PASS;
emailMessage.subject = subject;
emailMessage.wantsSecure = true;
let plainMsg = [
kSKPSMTPPartContentTypeKey : "text/plain",
kSKPSMTPPartMessageKey : message,
kSKPSMTPPartContentTransferEncodingKey : "8bit"
];
emailMessage.parts = [plainMsg];
emailMessage.send();
}
//MARK SKPSMTPMessageDelegate
#objc func messageSent(_ message: SKPSMTPMessage!) {
}
#objc func messageFailed(_ message: SKPSMTPMessage!, error: Error!) {
}
}
You should check out the SKPSMTPMessage framework. This allows you to send emails in the background. http://code.google.com/p/skpsmtpmessage/ It is not possible to do so yet, unless you code around MFMailComposeViewController which would presumably get your app rejected from the store (iOS5.0)
If you don't need to have the email sent from the iPhone users mail app, you could offload the action to a server and have the server mail it on the users behalf.
The only problem with this is that you may have spam issues depending on what service you use (Mail Chimp etc...).
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 17 days ago.
This post was edited and submitted for review 13 days ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
We send emails via the Admin API, with PDF attachments the PDF is then unreadable, with TXT files there is no problem.
Doku: https://shopware.stoplight.io/docs/admin-api/743f0819350c4-send-a-mail
Request-URL: _action/mail-template/send
We use the binAttachments parameter set as follows.
The "content" is fetched and without BASE64 encoding the JSON code is corrupt, if you encode it the mail can be sent. But the attachment is not valid with/without encoding.
$content = file_get_contents()
$binAttachments[] = ["content" => base64_encode($content),
"fileName" => 'test.pdf',
"mimeType" => 'application/pdf'
];
No decode is done in the API controller, here is my suggestion for change?
Adjustment of the controller
\Shopware\Core\Content\MailTemplate\Api\MailActionController
public function send(RequestDataBag $post, Context $context): JsonResponse
direkt nach der Zeile
$data = $post->all();
/optionale Decodierung des Strings, falls es ein BASE64 ist/
foreach ($data['binAttachments'] as &$binAttachment) {
if (base64_decode($binAttachment['content'], true)) {
// is valid $binAttachment['content'] = base64_decode($binAttachment['content']);
} else {
// not valid, Nothing to do
}
}
In addition, an issue has already been created:
https://issues.shopware.com/issues/NEXT-25189
Description see above
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to make this a single assignment property
val movesWithMetaDataList: MutableList<PokemonMoveWithMetaData> = arrayListOf()
for (move in pokemonWithMovesAndMetaData.moves) {
for (metaData in pokemonWithMovesAndMetaData.pokemonMoveMetaData) {
if (move.name == metaData.moveName) {
movesWithMetaDataList.add(
PokemonMoveWithMetaData(
metaData, move
)
)
}
}
}
setPokemonMoves(movesWithMetaDataList.separateByGeneration())
Ive tried a bunch of things I think I want a filter and then a map but I'm struggling to figure it out, the lists can be different sizes
tried this
val movesWithMetaDataList = pokemonWithMovesAndMetaData.moves.flatMap { move ->
pokemonWithMovesAndMetaData.pokemonMoveMetaData.map { metaData ->
if (metaData.moveName == move.name){
PokemonMoveWithMetaData(
metaData, move
)
}
}
}
and this
val movesWithMetaDataList = pokemonWithMovesAndMetaData.moves.flatMap { move ->
pokemonWithMovesAndMetaData.pokemonMoveMetaData.takeWhile {
pokemonMoveMetaData -> move.name == pokemonMoveMetaData.moveName
}.map { meta ->
PokemonMoveWithMetaData(
meta , move
)
}
}
and others 🤣
I think this should be it:
val movesWithMetaDataList = pokemonWithMovesAndMetaData.moves
.flatMap { move ->
pokemonWithMovesAndMetaData.pokemonMoveMetaData
.filter { it.moveName == move.name }
.map { PokemonMoveWithMetaData(it, move) }
}
For each move I find the metadata for that move using filter, and then I use map to create PokemonMoveWithMetaData out of those. The flatMap function will flatten the lists created for each move/metadata-pair back into a single resulting list.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am looking for a plagiarism checker API that is based on C# code. I need to use it on my web service. I need to easily query plagiarism checking engine and get result for the originality of the text.
If you know any service that is similar to what I am asking it would be great!
I’m using an online plagiarism checker service called Copyleaks which offers an interface to integrate with their API (HTTP REST). It also provides interface which is fully compatible with C#.
Steps to integrate with Copyleaks API:
Register on Copyleaks website.
Create a new C# Console application project and install Copyleaks’ Nuget Package.
Use the following code which performs a webpage scan.
This code was taken from its SDK (GitHub):
public void Scan(string username, string apiKey, string url)
{
// Login to Copyleaks server.
Console.Write("User login... ");
LoginToken token = UsersAuthentication.Login(username, apiKey);
Console.WriteLine("\t\t\tSuccess!");
// Create a new process on server.
Console.Write("Submiting new request... ");
Detector detector = new Detector(token);
ScannerProcess process = detector.CreateProcess(url);
Console.WriteLine("\tSuccess!");
// Waiting to process to be finished.
Console.Write("Waiting for completion... ");
while (!process.IsCompleted())
Thread.Sleep(1000);
Console.WriteLine("\tSuccess!");
// Getting results.
Console.Write("Getting results... ");
var results = process.GetResults();
if (results.Length == 0)
{
Console.WriteLine("\tNo results.");
}
else
{
for (int i = 0; i < results.Length; ++i)
{
Console.WriteLine();
Console.WriteLine("Result {0}:", i + 1);
Console.WriteLine("Domain: {0}", results[i].Domain);
Console.WriteLine("Url: {0}", results[i].URL);
Console.WriteLine("Precents: {0}", results[i].Precents);
Console.WriteLine("CopiedWords: {0}", results[i].NumberOfCopiedWords);
}
}
}
Call the function with your Username, API-Key and the URL of the content you wish to scan for plagiarism.
You can read more about its server in "How To" tutorial.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I Already done updating the password in database using SQLAdpaters in IBM Worklight Hybrid App.
I am Working on Hybrid App using IBM Worklight. I am updating user password in database using SQLAdapter, but I want to store password in encrypted format. I already have the encryption and decryption logic in java class. How can I integrate that java class with my hybrid app?
var procedure1Statement = WL.Server.createSQLStatement("UPDATE USERS SET USERPASSWORD=? WHERE USERNAME = ? AND USERPASSWORD=? ");
function updateUserPassword(newPassword,userName,password) {
return WL.Server.invokeSQLStatement({
preparedStatement : procedure1Statement,
parameters : [newPassword,userName,password]
});
}
changed code as follows
var userpwdUpdateStatement = WL.Server.createSQLStatement("UPDATE USERS SET USERPASSWORD=? WHERE USERNAME = ? AND USERPASSWORD=? ");
function updateUserPassword(newPassword,userName,password) {
var encryptdecryptutility = new com.abcd.bgf.SysCRAESencrpDecrp();
var encryptnewPassword = encryptdecryptutility.encrypt(newPassword);
var encryptoldPassword = encryptdecryptutility.encrypt(password);
return WL.Server.invokeSQLStatement({
preparedStatement : userpwdUpdateStatement,
parameters : [encryptnewPassword,userName,encryptoldPassword]
});
}
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
My app uses a SyncAdapter to periodically sync server data with SQLite. It also syncs this data in response to a GCM message that indicates new/updated server data; via. an IntentService.
These components each do their work in different background threads and are created by different system processes (SyncManager/GCM broadcast) and have different lifecycles; unpredictably!
What is the best approach to fault-tolerantly co-ordinate these components: e.g.
for an Activity to signal to each that they should do no work
to signal to the SyncAdapter to do no work when the GCM IntentService is working, and vice versa.
You should
Put all your syncing code into the SyncAdapter
Remove the IntentService
In the GcmBroadcastReceiver you start the SyncAdapter instead of the IntentService.
Below is example code copied from the SyncAdapter documentation.
public class GcmBroadcastReceiver extends BroadcastReceiver {
...
// Constants
// Content provider authority
public static final String AUTHORITY = "com.example.android.datasync.provider"
// Account type
public static final String ACCOUNT_TYPE = "com.example.android.datasync";
// Account
public static final String ACCOUNT = "default_account";
// Incoming Intent key for extended data
public static final String KEY_SYNC_REQUEST =
"com.example.android.datasync.KEY_SYNC_REQUEST";
...
#Override
public void onReceive(Context context, Intent intent) {
// Get a GCM object instance
GoogleCloudMessaging gcm =
GoogleCloudMessaging.getInstance(context);
// Get the type of GCM message
String messageType = gcm.getMessageType(intent);
/*
* Test the message type and examine the message contents.
* Since GCM is a general-purpose messaging system, you
* may receive normal messages that don't require a sync
* adapter run.
* The following code tests for a a boolean flag indicating
* that the message is requesting a transfer from the device.
*/
if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)
&&
intent.getBooleanExtra(KEY_SYNC_REQUEST)) {
/*
* Signal the framework to run your sync adapter. Assume that
* app initialization has already created the account.
*/
ContentResolver.requestSync(ACCOUNT, AUTHORITY, null);
...
}
...
}
...
}