sending an email in android ... - email

I am trying to send an email from my app.
the code goes lik this :
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient#gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
startActivity(Intent.createChooser(i, "Send mail..."));
in the emulator it shows the email client again i have to enter the recipient address, when i click send button it doesnt send .
and it is showing the messaging(MMS) context.
any help is highly appreciated ...

here the problem was the email client was not configured in the emulator,,,
It works fine in the device ...

Related

Sending Email From Flutter App Using flutter_email_sender or mailer

I am trying to Send mail from Flutter App using flutter_email_sender
sendEmail(){
final Email email = Email(
subject: "Text",
body: "${User.userEmail + User.userCategory}",
recipients: ["${User.userEmail}"],
isHTML: false,
);
FlutterEmailSender.send(email);
}
But the above code is opening mail application which is not I am trying to do.
I'm trying to send the mail on button click directly without using this application.
I know there is package called mailer, can any one suggest how to implement this with my backend (php).

I am using NSSharingService in my macOS Swift app. Is there any way to make sure the default mail client is configured with a valid account?

I am using NSSharingService to prepare an email with attachment for the user of my macOS app. My code is:
let emailService = NSSharingService.init(named: NSSharingService.Name.composeEmail)
if emailService.canPerform(withItems: [emailBody, zipFileURL]) {
// email can be sent
DispatchQueue.main.async {
emailService.perform(withItems: [emailBody, zipFileURL])
}
} else {
// email cannot be sent
// Show alert with email address and instructions
self.showErrorAlert(with: 2803)
}
This works correctly, but if the code is executed on a fresh system, Apple Mail will be opened asking the user to configure an email account. Some users may not understand what is going on in this situation. Is there a way to ascertain if the default Email Client is configured, so that I can inform the user if it is not ? Thanks for your help.

Send a contact us form details to email in Dart

I am making a Contact us form page in my Flutter app and would like to send the details of the form (email of the user, name and the message) to my email address when the user hits the Send button. I don't want to launch the gmail app from phone for this. Are there any other ways to this?
Thanks!
Of course, you can.
You can use the flutter_email_sender package or flutter_mailer package. Both of them are very similiar.
For example if you are using flutter_email_sender package,
final Email myFormEmail = Email(
body: 'Email body', // This could be from the form field's value
subject: 'Email subject', // Subject (maybe type of question, etc)
recipients: ['example#example.com'], // This is receiver (maybe your email)
cc: ['cc#example.com'],
bcc: ['bcc#example.com'],
attachmentPaths: ['/path/to/attachment.zip'], // Attachments
isHTML: false,
);
And then inside the 'SEND' button, add this kind of code:
await FlutterEmailSender.send(myFormEmail);
Please check "mailer" package from flutter. It will use smtp to send email from background without opening userinterface app. It has gmail, yahoo mail, mailgun options to send email.
The Reference link :
https://pub.dartlang.org/packages/mailer

Laravel email confirmation email sent or failed, Email preview and editable

Laravel5 Currently i am facing issue unable to check the status email is sent and not even getting email failed and i am using mandrill api for sending emails
$mail = Mail::send('emails.pendingorder', $data , function($message) use ($domain, $order)
{
if ($order->other_email) {
$message->from($domain->email, $domain->website);
$message->to($order->email, $order->name)->subject('test Email ');
$message->bcc($order->other_email, $order->name)->subject('test Email ');
}else{
$message->from($domain->email, $domain->website);
$message->to($order->email, $order->name)->subject('test Email ');
}
});
if($mail){
echo 'sent';
}else{
echo 'Fail';
}
The second thing..
i created email templates in blade and i want to preview email in ckeditor if there any any chaning or modification require then i edit the content and send email. i havn't any idea how to to this :(
Its my first try with laravel email and i am totally stuck with it
Do you have correct configuration in config/mail.php? Remember to change pretend to false. Also, Mail::send returns void, so you will have to check status on your mandrill account.
For editing email before sending it:
create form with ckeditor
fill this form with your default template
after submitting you have email body in your request, you can pass it to your email view
If you want your email to be fully editable, instead of having email view with only one variable you can use:
Mail::raw('This will be body of your email', function($message) {
// ...
});

How to Take a photo and attach the photo in an e-mail and send

I want to achieve the following
In my app, there will be a screen which allows you to take a picture
Once user has taken the picture, he will get an option to send the picture to the predefined email Id as an attachment.
Can someone throw some light or give me direction on how to achieve this?
For info on how to take a photo in your app, take a look at the Android Developer documentation. It is detailed and it has a sample project that you can use.
To send emails, you could use the code snippet from this SO Answer, shown below:
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient#example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
I hope this helps.