Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // TODO: SEND MAIL
- void _sendMail() async {
- if (!_formKey.currentState.validate()) {
- return;
- } else {
- _formKey.currentState.save();
- var _options = new GmailSmtpOptions()
- ..username = “mymailaddress@gmail.com"
- ..password = “myPassword”;
- var _emailTransport = new SmtpTransport(_options);
- var _envelope = new Envelope()
- ..from = "mymailaddress@gmail.com"
- ..recipients.add(_receiverMailAddress)
- ..subject = "${_userDekontDetails[0][0].toString()} - Receipt”
- ..attachments.add(await new Attachment(file: await new File('$newDekontImage')))
- ..text = "${_userDekontDetails[0][0].toString()} - Receipt"
- ..html = '<h3>${_userDekontDetails[0][0].toString()} Receipt.</h3>'
- '<p>Hi, registered under my name, I am sending the receipt (${widget._currentUserReceiptNo}) with attached to this mail.</p>'
- '<p></p>'
- '<h5>Regards, </br></h5>'
- '${_userDekontDetails[0][0].toString()}';
- _emailTransport.send(_envelope)
- ..then((envelope) => print('Email sent'))
- ..catchError((e) => print('Error occured: $e'));
- }
- }
Add Comment
Please, Sign In to add comment