I'm trying to put a pop or even an alertedialog to announce that the message is sent or not.
Currently I only have a print that displays but in the console .. So not useful for the user.
How do I get to my goal?
sendMail() async {
// Information connexion serveur smtp
String username = 'xxx';
String password = 'xxxx';
String domainSmtp = 'xxx';
final smtpServer = SmtpServer(domainSmtp,
username: username, password: password, port: 587);
//Création du message
final message = Message()
..from = Address(username, '')
..recipients.add('xxxx')
//..ccRecipients.addAll(['[email protected]', '[email protected]'])
//..bccRecipients.add(Address('[email protected]'))
..subject =
"Demande :: ?? :: ${DateTime.now()}"
..text = ''
..html =
"<h1>Nom: ${nomController.text} <p></p> Prénom: ${prenomController.text} <p></p> Email: ${emailController.text}</h1> <img src="data:images/Logo_fini2.1.png>
<p></p>";
try {
final sendReport2 = await send(message, smtpServer);
var connection = PersistentConnection(smtpServer);
await connection.send(message);
await connection.close();
print('Message envoyé: ' + sendReport2.toString());
} on MailerException catch (e) {
print('cMessage envoyé.');
for (var p in e.problems) {
print('Probleme: ${p.code}: ${p.msg}');
}
}
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…