I am using enough_mail dependency for my mail client Flutter app. My requirement is how to reply to a mail. Here is how I build the Message.
You need to initialize MessageBuilder bellow way
MessageBuilder messageBuilder = MessageBuilder.prepareReplyToMessage(
mimeMessage,
MailAddress('', senderEmail),
replyAll: false,
quoteOriginalText: true,
replyToSimplifyReferences: true
)
Related
Hope someone can assist. Been struggling now for about 2 weeks to get the fcm push notification working on flutter web app. Using flutter 3.0.7.
I created a firebase project and set it up with cli and recieved a firebase_options.dart file with the web options. Then created a firebase-messaging-sw.js file.
When testing from firebase console I recieve a message. But as soon as I use the rest api to send a message it shows it send the message but no message is recieved. It show the following
FCM request for web sent!
{"multicast_id":3383324657233668851,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}
]}
FCM request for web sent!
{"multicast_id":5796359055236685312,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}
]}
I use the following to send the message after getting the registered key of the device I would like to send to
sendPushMessageToWeb(String? token) async {
final endpoint = "https://fcm.googleapis.com/fcm/send";
final header = {
'Authorization': 'key=7rZmxGEjVqGk0JPi0Fospb0Us47eIn8IqIDeobU8KGFbMoAYTZ-',
'Content-Type': 'application/json'
};
http.post(
Uri.parse(endpoint),
headers: header,
body: jsonEncode({
"to": "${token}",
"notification": {"body": "YOUR NOTIFICATION BODY TEXT", "title": "YOUR NOTIFICATION TITLE TEXT", "sound": "default"}
})
)
print('FCM request for web sent!');
}
It looks like it complains about the registration key but using that same key in console works.
Why would it send and recieve message from console but not from rest api? I did not made any changes in my index.html file for the code lab I used at first and is unable to find again after all my searches did not mension anything about the changes and the console messages is recieved.
Thank you
My own mistake for not thinking. I never checked the length of the token. The variable on my php mysql was only 100 long but the token is longer than that. Thank you.
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).
Hello i have app written in flutter which uses data from parse server.
According to flutter doc:
/// Reset password
response = await user.requestPasswordReset();
if (response.success) {
user = response.result;
}
I'd like to send e-mail using my parser with change password link.
When i press button with that function assigned - i get information: "E-mail sent"
On flutter side i'm getting that output:
Function: ParseApiRQ.requestPasswordReset
I/flutter (28247): Status Code: 200
I/flutter (28247): Payload: {"className":"_User","email":"testazaz#gmail.com"}
On parser side i have installed something like this:
simple-parse-smtp-adapter Configured as doc says.
I don't getting any Error/Info logs from parser. Can you tell me how to configure it properly? Maybe you know other way - how to connect flutter with parser to send e-mail verification or password change e-mails.
After couple days i finally resolved this problem with help of #DaviMacêdo.
I implemented Sendgrid Adapter.
In your parse node-modules folder install this module using cmd:
npm i parse-server-sendgrid-adapter
Remember to require module at the top of the file:
var SimpleSendGridAdapter = require('parse-server-sendgrid-adapter');
var api = new ParseServer({
...,
emailAdapter: SimpleSendGridAdapter({
apiKey: 'sendgridApiKey',
fromAddress: 'fromEmailAddress',
})
});
You can get api key here
and set up sender e-mail here
I hope it helps saving much time for others facing the same problem!
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
I wante to create a buton to be used when the suer wants to report a problem they can press it an will send them to their email app with my email already writen on it so they only need to write the email and I was wondering if that is a posibility on flutter.
Yes. Take a look at the url_launcher package. You can even set the subject and the body of the email.
Just search through the flutter packages. I personally have used flutter_email_sender which has a pretty full feature set, including subject, body and also attachments.
e.g.
final Email email = Email(
body: 'Email body',
subject: 'Email subject',
recipients: ['example#example.com'],
attachmentPaths: ['/path/to/attachment.zip'],
);
await FlutterEmailSender.send(email);