private void ExecuteSendEmailAutomacaoPredialCommand() { var emaillMesseger = CrossMessaging.Current.EmailMessenger; if (emaillMesseger.CanSendEmail) { var pessoa = PessoaJuridica ? "Pessoa Jurídica" : "Pessoa Física"; var tipoImovel = Residencial ? "Residencial" : Comercial ? "Comercial" : Condominio ? "Condomínio" : Industria ? "Industria" : "Pedraria"; var tipoServico = SegurancaEletronica ? "Segurança eletrônica" : CircuitoFechado ? "Circuito fechado de TV" : ReusoAgua ? "Reuso de águas cinzaz para descargas" : "Geração de energia fotovoltaica"; var tipoTelhado = Inclinado ? "Inclinado" : "Platibanda"; var message = $"Nome do responsável {Responsavel} - {pessoa} \n" + $"{Endereco} - {CEP} \n" + $"{Email} - {Telefone} \n" + $"Tipo do imóvel: {tipoImovel} \n" + $"Tipo do serviço: {tipoServico} \n " + $"Valor mensal da conta é de {ValorCota} \n" + $"Consumo mensal de {Consumo} KWh \n" + $"Tipo do telhado: {tipoTelhado} \n" + $"Possui uma área de {Area} m²"; var email = new EmailMessageBuilder() .To("*****@*****.**") .Subject("[Formulário] Automação predial e residencial") .Body(message) .Build(); emaillMesseger.SendEmail(email); } }
public void Decline_RequestDoesNotExist_DbNotChanged() { // Arrange MockRequestServiceThrowsInvalidKeyValueException(); Exception exception = null; var emailMessage = new EmailMessageBuilder().Build(); MockMailService(emailMessage); var expected = new TournamentRequestBuilder().Build(); MockGetRequestByIdQuery(expected); MockGetUser(); var sut = BuildSUT(); // Act try { sut.Decline(INVALID_REQUEST_ID, emailMessage.Body); } catch (MissingEntityException ex) { exception = ex; } // Assert VerifyDeleteRequest(INVALID_REQUEST_ID, Times.Once(), Times.Never()); }
public async void sendOnCall() { manager = SignupManager.DefaultManager; emplist = await manager.getEmails(); //int c = emplist.Count; emails = new String[emplist.Count]; for (int i = 0; i < emplist.Count; i++) { emails[i] = emplist[i].Email; } var emailMessenger = CrossMessaging.Current.EmailMessenger; if (emailMessenger.CanSendEmail) { // Send simple e-mail to single receiver without attachments, bcc, cc etc. //emailMessenger.SendEmail("*****@*****.**", "Xamarin Messaging Plugin", "Well hello there from Xam.Messaging.Plugin"); // Alternatively use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc. var email = new EmailMessageBuilder() .To(emails) .Subject("On-Call Shift") .Body("Shift " + shift + " at " + workplace + " on " + workday + " is available.Please pick up!") .Build(); emailMessenger.SendEmail(email); } }
private void SendEmail_Clicked(object sender, EventArgs e) { var emailMessenger = CrossMessaging.Current.EmailMessenger; string emailToBeSent = (string)Application.Current.Properties["ToBeSend"]; Debug.WriteLine("************" + emailToBeSent); if (emailMessenger.CanSendEmail) { // Send simple e-mail to single receiver without attachments, bcc, cc etc. //emailMessenger.SendEmail("*****@*****.**", "Xamarin Messaging Plugin", "Well hello there from Xam.Messaging.Plugin"); // Alternatively use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc. var email = new EmailMessageBuilder() .To("*****@*****.**") .Cc("*****@*****.**") .Bcc(new[] { "*****@*****.**", "*****@*****.**" }) .Subject("Help") .Body(emailToBeSent) .Build(); emailMessenger.SendEmail(email); hole.IsVisible = false; Application.Current.Properties.Clear(); } }
void SendMailCommand() { var emailMessenger = MessagingPlugin.EmailMessenger; if (emailMessenger.CanSendEmail) { String timeStamp = DateTime.Now.ToString("dd.MM.yyyy"); string mailContent = "WorkOut Summary\n"; mailContent += "\n\n"; mailContent += "Group ID:\t" + GroupId + "\n"; mailContent += "Number Of Participants:\t" + NumOfParticipants.ToString() + "\n"; mailContent += "Activity Level:\t" + Activity_Level + "\n"; mailContent += "Activity Time:\t" + ActivityTime + "\n"; mailContent += "Number Of Alerts:\t" + NumOfAlerts.ToString() + "\n"; mailContent += "Dehydrated Members Percentage:\t" + Dehydrated_Percentage.ToString() + "%" + "\n"; mailContent += "Least Hydrated User:\t" + Dehydrated_User + "\n"; mailContent += "Highest Fluid Loss Recorded:\t" + H_FluidLoss_Recorded.ToString() + "%" + "\n"; mailContent += "Most Hydrated User:\t" + Hydrated_User + "\n"; mailContent += "Lowest Fluid Loss Recorded:\t" + L_FluidLoss_Recorded.ToString() + "%" + "\n"; mailContent += "Highest Lowest Record Difference:\t" + D_FluidLoss_Recorded.ToString() + "%" + "\n"; mailContent += "Group Performance:\t" + Group_performance + "\n"; mailContent += "\n\n"; var email = new EmailMessageBuilder() .To(App.User.email.ToString()) .Subject("Hydrapp Workout Summary " + timeStamp) .Body(mailContent) .Build(); emailMessenger.SendEmail(email); } }
public IEmailMessage EmailMessage(string filename) { string root = null; //Get the root path in android device. if (Android.OS.Environment.IsExternalStorageEmulated) { root = Android.OS.Environment.ExternalStorageDirectory.ToString(); } else { root = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } //Create directory and file Java.IO.File myDir = new Java.IO.File(root + "/MRP"); myDir.Mkdir(); Java.IO.File file = new Java.IO.File(myDir, string.Format("{0}.xlsx", filename)); var emailprueba = new EmailMessageBuilder() .Subject(string.Format("Hoja de càlculo del Producto {0}", filename)) .Body(string.Format("Envío el archivo con la hoja de cálculos del producto {0}. Saludos", filename)) .WithAttachment(file) .Build(); return(emailprueba); }
public Task <Unit> Handle(ProcessoRemovidoEvent request, CancellationToken cancellationToken) { try { if (request.ResponsaveisIds?.Any() == true) { var emailMessageBuilder = new EmailMessageBuilder(); foreach (var responsavelId in request.ResponsaveisIds) { var responsavel = this.responsavelRepository.ObterPorId(responsavelId); emailMessageBuilder.To(responsavel.Email.ToString()); } var emailMessage = emailMessageBuilder .Subject($"Processo Removido - Número: {request.NumeroProcesso}") .Body($"O processo de número {request.NumeroProcesso} foi removido.").Build(); this.emailService.SendEmail(emailMessage); } } catch (System.Exception e) { this.logger.LogError(e, "Erro Inesperado"); } return(Unit.Task); }
void OnEmailTapped(object sender, System.EventArgs e) { string deviceUID = DependencyService.Get <IDeviceService>().DeviceIdentifier(); string appPlatform = Device.RuntimePlatform == Device.Android ? Device.Android.ToString() : Device.iOS.ToString(); string appVersion = DisplayInfo.VersionAndBuildNumber; string appOS = CrossDeviceInfo.Current.Version; string appModel = CrossDeviceInfo.Current.Model; Log.Information("=============================================="); Log.Information("=== SUPPORT REQUEST ==="); Log.Information($"Device: {appModel} OS: {appPlatform} {appOS}"); Log.Information($"Version: {appVersion} UID: {deviceUID}"); var errorMessage = string.Empty; if (AppSettings.LastLogFile == string.Empty) { errorMessage = "No log files found"; } else { try { Log.Information($"Attach log file request {AppSettings.LastLogFile}"); //Log.CloseAndFlush(); var emailMessenger = CrossMessaging.Current.EmailMessenger; if (emailMessenger.CanSendEmailAttachments) { // Construct email with attachment on Android. Log.Information("Building sent"); var email = new EmailMessageBuilder() .To("*****@*****.**") .Subject("Support request").Body("Log files for " + AppSettings.ParticipantName + "\n\nPlease describe the issue you are experiencing:\n") .WithAttachment(AppSettings.LastLogFile, "text/*") .Build(); Device.BeginInvokeOnMainThread(() => { Log.Information("Sending email"); emailMessenger.SendEmail(email); }); } else { errorMessage = "Your device can't send email attachments."; } } catch (Exception ex) { errorMessage = ex.Message; } } if (!string.IsNullOrEmpty(errorMessage)) { App.Navigation.ShowError(errorMessage); } }
public Task <Unit> Handle(ProcessoCriadoEvent request, CancellationToken cancellationToken) { try { var processo = this.processoRepository.ObterPorId(request.ProcessoId); var emailMessageBuilder = new EmailMessageBuilder(); foreach (var responsavel in processo.Responsaveis) { emailMessageBuilder.To(responsavel.Email); } var emailMessage = emailMessageBuilder .Subject($"Novo processo - Número: {processo.NumeroProcesso}") .Body($"Você foi cadastrado como envolvido no processo de número {processo.NumeroProcesso}.").Build(); this.emailService.SendEmail(emailMessage); } catch (System.Exception e) { this.logger.LogError(e, "Erro Inesperado"); } return(Unit.Task); }
private static IEnumerable <EmailMessageEntity> CreateEmailMessage(EmailTemplateEntity template, ModifiableEntity?modifiableEntity, ref IEmailModel?model, CultureInfo?cultureInfo = null) { Entity?entity = null; if (template.Model != null) { if (model == null) { model = EmailModelLogic.CreateModel(template.Model, modifiableEntity); } else if (template.Model.ToType() != model.GetType()) { throw new ArgumentException("model should be a {0} instead of {1}".FormatWith(template.Model.FullClassName, model.GetType().FullName)); } } else { entity = modifiableEntity as Entity ?? throw new InvalidOperationException("Model should be an Entity"); } using (template.DisableAuthorization ? ExecutionMode.Global() : null) { var emailBuilder = new EmailMessageBuilder(template, entity, model, cultureInfo); return(emailBuilder.CreateEmailMessageInternal().ToList()); } }
public async Task SaveAndView(string fileName, String contentType, MemoryStream stream) { string root = null; //Get the root path in android device. if (Android.OS.Environment.IsExternalStorageEmulated) { root = Android.OS.Environment.ExternalStorageDirectory.ToString(); } else { root = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); } //Create directory and file Java.IO.File myDir = new Java.IO.File(root + "/Syncfusion"); myDir.Mkdir(); Java.IO.File file = new Java.IO.File(myDir, fileName); //Remove if the file exists if (file.Exists()) { file.Delete(); } //Write the stream into the file FileOutputStream outs = new FileOutputStream(file); outs.Write(stream.ToArray()); outs.Flush(); outs.Close(); //Invoke the created file for viewing if (file.Exists()) { Android.Net.Uri path = Android.Net.Uri.FromFile(file); var emailMessanger = CrossMessaging.Current.EmailMessenger; if (emailMessanger.CanSendEmail) { var email = new EmailMessageBuilder() .To("*****@*****.**") .Subject("Punches") .Body("Test Run") .WithAttachment(file) .Build(); emailMessanger.SendEmail(email); } //string extension = Android.Webkit.MimeTypeMap.GetFileExtensionFromUrl(Android.Net.Uri.FromFile(file).ToString()); //string mimeType = Android.Webkit.MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension); //Intent intent = new Intent(Intent.ActionView); //intent.SetDataAndType(path, mimeType); //Forms.Context.StartActivity(Intent.CreateChooser(intent, "Choose App")); } }
public void SendEmail() { var emailMessenger = CrossMessaging.Current.EmailMessenger; var currentDate = DateTime.Now.ToString("yyyyMMdd"); if (emailMessenger.CanSendEmail) { if (File.Exists(Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, $"DanceConvention_log-{currentDate}.txt"))) { var email = new EmailMessageBuilder() .To("*****@*****.**") .Subject("DanceConvention Client - Error Report") .WithAttachment(Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, $"DanceConvention_log-{currentDate}.txt")) .Build(); emailMessenger.SendEmail(email); } else { App.DisplayLogAlert(); } } }
public void Create_FeedbackPassed_FeedbackCreated() { // Arrange var newFeedback = new FeedbackBuilder() .Build(); var emailMessage = new EmailMessageBuilder().Build(); MockMailService(emailMessage); MockUserService(); var sut = BuildSUT(); // Act sut.Create(newFeedback); // Assert VerifyCreateFeedback( newFeedback, Times.Once(), "Parameter feedback is not equal to Instance of feedback"); VerifySaveFeedback( newFeedback, Times.Once(), "DB should not be updated"); }
async void OnNotifyClicked(object s, EventArgs e) { manager = SignupManager.DefaultManager; emplist = await manager.getEmails(); emails = new String[emplist.Count]; for (int i = 0; i < emplist.Count; i++) { emails[i] = emplist[i].Email; } var emailMessenger = CrossMessaging.Current.EmailMessenger; if (emailMessenger.CanSendEmail) { // use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc. var email = new EmailMessageBuilder() .To(emails) .Subject("Notification about the schedule") .Body("The latest schedule is updated please check your shifts!") .Build(); emailMessenger.SendEmail(email); } }
internal Task EnviarReporte(string reporte, string correo) { var emailMessenger = CrossMessaging.Current.EmailMessenger; if (emailMessenger.CanSendEmail) { // Send simple e-mail to single receiver without attachments, bcc, cc etc. //emailMessenger.SendEmail("*****@*****.**", "Xamarin Messaging Plugin", "Well hello there from Xam.Messaging.Plugin"); try { // Alternatively use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc. var email = new EmailMessageBuilder() .To(correo) // .Cc("*****@*****.**") // .Bcc(new[] { "*****@*****.**", "*****@*****.**" }) .Subject($"Reporte Tiendita del Praga para el mes de {MesSeleccionado.Nombre}") .Body($"Adjunto --> Reporte Tiendita del Praga para el mes de {MesSeleccionado.Nombre}") .WithAttachment(reporte, "text/plain") .Build(); emailMessenger.SendEmail(email); } catch (Exception ex) { //TODO - Show alert Debug.WriteLine(ex.Message); } } return(Task.FromResult(true)); }
public void EmailBow() { //based on code from https://github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/Details.md try { string fileBow = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "BowBackup.csv"); var emailMessenger = CrossMessaging.Current.EmailMessenger; if (emailMessenger.CanSendEmail) { var email = new EmailMessageBuilder() .To("") .Subject("Archery Scoring App Database backup") .Body("Files for backing up database") .WithAttachment(fileBow, "BowBackup.csv") // .WithAttachment(filePathComp, "Comp720Backup.csv") // .WithAttachment(filePathPrac, "PracBackup.csv") .Build(); emailMessenger.SendEmail(email); } } catch (Exception ex) { string err = ex.ToString(); ArchMain.ErrorMess(err); } }
public void Create_TournamentRequesExist_RequestNotAdded() { // Arrange var newTournamentRequest = new TournamentRequestBuilder() .WithId(EXISTING_ID) .WithTeamId(EXISTING_ID) .WithGroupId(EXISTING_ID) .WithUserId(EXISTING_ID) .Build(); var emailMessage = new EmailMessageBuilder().Build(); MockMailService(emailMessage); MockUserService(); _tournamentRequestRepositoryMock.Setup( tr => tr.Add( It.IsAny <TournamentRequest>())) .Callback <TournamentRequest>(t => t.Id = EXISTING_ID); MockGetAllTournamentRequestQuery(newTournamentRequest); var sut = BuildSUT(); // Act sut.Create(newTournamentRequest); // Assert VerifyCreateTournamentRequest(newTournamentRequest, Times.Never(), "Parameter request is not equal to Instance of request"); }
void Send_Clicked(object sender, System.EventArgs e) { string html = genHTML(); string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "chart.html"); File.WriteAllText(fileName, html); var emailMessenger = CrossMessaging.Current.EmailMessenger; if (emailMessenger.CanSendEmail) { var email = new EmailMessageBuilder() //.To("*****@*****.**") //.Cc("*****@*****.**") //.Bcc(new[] { "*****@*****.**", "*****@*****.**" }) .Subject(AppResources.EmailSubjectLabel) .Body(AppResources.EmailBodyLabel) .WithAttachment(fileName, "text/html") .Build(); emailMessenger.SendEmail(email); } else { DisplayAlert(AppResources.AlertLabel, AppResources.SendErrorLabel, AppResources.OKLabel); } }
void SendEmail(string address) { Debug.WriteLine($"Sending email to {address}"); var emailTask = CrossMessaging.Current.EmailMessenger; if (emailTask.CanSendEmailBodyAsHtml) { // get a pointer to prayer page so we can retrieve the date details, and the html prayer IPrayer iPrayer = FreshMvvm.FreshIOC.Container.Resolve <IPrayer>(); string subject = iPrayer.PrayerHeading.Replace(" ;", ";").Replace(PrayerSeason._singleLE, "; "); // Construct HTML email (iOS and Android only) to single receiver without attachments, CC, or BCC. var email = new EmailMessageBuilder() .To(address) .Subject(subject) //.Body(iPrayer.PrayerHtml) .BodyAsHtml(iPrayer.PrayerHtml) .Build(); emailTask.SendEmail(email); } Debug.WriteLine($"Sent email to {address}"); EmailAddress = ""; CoreMethods.PopPageModel(); }
static void Main(string[] args) { // Build & Read Configuration var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true) .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true) .AddEnvironmentVariables(); var configuration = builder.Build(); var apiKey = configuration["Api_Key"]; var subject = configuration["Email_Subject"]; var from = configuration["Email_From"]; var body = configuration["Email_Body"]; var to = configuration["Email_To"]; // Prepare Email Message var message = EmailMessageBuilder .Init() .AddSubject(subject) .AddFrom(from) .AddBody(body) .AddTo(to) .Build(); // Send Email Message IAzureEmailSender sender = new AzureEmailSender(new AzureEmailSettings(apiKey)); var response = sender.SendAsync(message).Result; Console.WriteLine(response.StatusCode); Console.ReadLine(); }
public bool SendEmail(string recipient, string from, string subject, string body) { var emailMessenger = CrossMessaging.Current.EmailMessenger; if (emailMessenger.CanSendEmail) { // Send simple e-mail to single receiver without attachments, bcc, cc etc. // emailMessenger.SendEmail("*****@*****.**", "Xamarin Messaging Plugin", "Well hello there from Xam.Messaging.Plugin"); // Alternatively use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc. var email = new EmailMessageBuilder() .To(recipient) //.Cc("*****@*****.**") //.Bcc(new[] { "*****@*****.**", "*****@*****.**" }) .Subject(subject) .Body(body) .Build(); emailMessenger.SendEmail(email); return(true); } return(false); }
private void ExecuteSendEmailSintoniaCommand() { var emaillMesseger = CrossMessaging.Current.EmailMessenger; if (emaillMesseger.CanSendEmail) { var tipoServico = AvaliacaoMalha ? "Avaliação de malhas de controle" : SintoniaMalha ? "Sintonia de malhas de controle" : "Avaliação de sintonia de malhas de controle"; var message = $"Nome da empresa {NomeEmpresa} \n" + $"Nome do responsável {NomeResponsavel} \n" + $"Endereço: {EnderecoSintonia} \n" + $"{EmailSintonia} - {TelefoneSintonia} \n" + $"Tipo do Serviço: {tipoServico} \n" + $"{Descricao} \n" + $"Quantidade total de malhas de temperatura {MalhaTemperatura} \n" + $"Quantidade total de malhas de nível {MalhaNivel}\n " + $"Quantidade total de malhas de pressão {MalhaPressao} \n" + $"Quantidade total de malhas de vazão {MalhaVazao} \n" + $"Quantidade total de outras malhas {OutraMalha}\n"; var email = new EmailMessageBuilder() .To("*****@*****.**") .Subject("[Formulário] Avaliação e sintonia de malhas de controle") .Body(message) .Build(); emaillMesseger.SendEmail(email); } }
private void Boton_Enviar(object sender, EventArgs e) { String texto = msj.Text; var emailTask = CrossMessaging.Current.EmailMessenger; if (emailTask.CanSendEmail) { var email = new EmailMessageBuilder() .Subject("ALUMNO DESDE DISCRETAPP") .Body(texto) ; if (switch1.IsToggled) { email.To("*****@*****.**"); } if (switch2.IsToggled) { email.To("*****@*****.**"); } if (switch3.IsToggled) { email.To("*****@*****.**"); } if (switch4.IsToggled) { email.To("*****@*****.**"); } if (switch5.IsToggled) { email.To("*****@*****.**"); } if (switch6.IsToggled) { email.To("*****@*****.**"); } emailTask.SendEmail(email.Build()); } //{ // for (int i = 0; i < correosParaEnviar.Count(); i++) // email.SendEmail(correosParaEnviar[i], "ALUMNO DESDE DISCRETAPP", texto); //} Application.Current.MainPage.DisplayAlert("Exito", "Su mensaje se ha enviado", "Aceptar"); }
/// <summary> /// Controllo che tutto sia ok, in caso mando finalmente la mail /// </summary> /// <param name="sender"> /// </param> /// <param name="e"> /// </param> private void ButtonSendEmail_Clicked(object sender, EventArgs e) { // Se possibile calcolo quale sia la mail prendendola da quelle salvate, Al momento ho // solo quella di cattolica, se non trovo quella da usare la chiedo all'utente if (String.IsNullOrWhiteSpace(EntryEmail.Text) || !Utils.CheckValidEmail(EntryEmail.Text)) { this.DisplayAlertOnMain("Town hall email not found or invalid", "Please enter it and send again", "Ok"); } else { try { // Genero il testo var sb = new StringBuilder().AppendLine("Hello there!") .AppendLine("I found a problem, it's here:") .AppendLine(LabelAddress.Text) .AppendLine() .AppendLine("Latitude:") .AppendLine(_currentPosition.Latitude.ToString()) .AppendLine("Longitude:") .AppendLine(_currentPosition.Longitude.ToString()) .AppendLine() .AppendLine("Google Maps Link:") .Append("https://www.google.com/maps/search/?api=1&query=") .Append(Utils.FormatCoordinate(_currentPosition.Latitude)) .Append(",") .AppendLine(Utils.FormatCoordinate(_currentPosition.Longitude)); // Se non sono nulli o non si è lasciato il placeholder, inserisco i commenti if (!String.IsNullOrWhiteSpace(EditorComments.Text) && !EditorComments.Text.Equals("Write here your comments...")) { sb.AppendLine() .AppendLine("Comments:") .AppendLine(EditorComments.Text); } // Prendo il messenger, ho già controllato che l'utente abbia i permessi se siamo qui var emailMessenger = CrossMessaging.Current.EmailMessenger; // Creo la mail con l'allegato var email = new EmailMessageBuilder() .To(EntryEmail.Text) .Subject($"A problem has been found! {Guid.NewGuid()}") .Body(sb.ToString()) .WithAttachment(_savedImageFilePath, "image/jpeg") .Build(); emailMessenger.SendEmail(email); } catch (Exception ex) { this.DisplayAlertExceptionOnMain(ex); } } }
public IEmailMessage SendEmailWithAttachment(string filename, string emailAddress) { NSUrl file = new NSUrl(filename, false); var email = new EmailMessageBuilder() .To(emailAddress) .Subject("Xamarin Messaging Plugin") .Body("Well hello there from Xam.Messaging.Plugin") .WithAttachment(file).Build(); return(email); }
private void SendEmail(string path) { var emailMessenger = CrossMessaging.Current.EmailMessenger; var email = new EmailMessageBuilder() .Subject("Subject line ") .Body("Body of the email") .WithAttachment(path, ".pdf") .Build(); emailMessenger.SendEmail(email); }
public void CanBuild() { // Act string parsedMessage = new EmailMessageBuilder() .AddTo(To) .SetSubject(Subject) .Build(); // Assert AssertMessage(parsedMessage); }
private void SendEmail(string path) { Java.IO.File file = new Java.IO.File(path); var emailMessenger = CrossMessaging.Current.EmailMessenger; var email = new EmailMessageBuilder() .Subject("Subject line ") .Body("Body of the email") .WithAttachment(file) .Build(); emailMessenger.SendEmail(email); }
public async void Export() { var email = new EmailMessageBuilder() .To("*****@*****.**") .Subject("DBExport") .Body("Hello from your friends at Xamarin!") .WithAttachment(helper.GetDBPath(), "application/octet-stream").Build(); if (CrossMessaging.Current.EmailMessenger.CanSendEmail) { CrossMessaging.Current.EmailMessenger.SendEmail(email); } }
public void SendMessageAsync() { var readings = new string[0]; var emailMessenger = CrossMessaging.Current.EmailMessenger; var message = _mailMessageProvider.Provide(readings); var email = new EmailMessageBuilder() .To(_settings.MessageRecipient) .Subject(_settings.MessageSubject) .Body(message) .Build(); emailMessenger.SendEmail(email); }
public static EmailMessageBuilder BuildSampleEmail(bool sendAsHtml = false) { var builder = new EmailMessageBuilder() .To("*****@*****.**") .Cc("*****@*****.**") .Bcc(new[] { "*****@*****.**", "*****@*****.**" }) .Subject("Xamarin Messaging Plugin"); #if __ANDROID__ || __IOS__ if (sendAsHtml) builder.BodyAsHtml("Well hello there from <b>Xam.Messaging.Plugin</b>"); #endif if (!sendAsHtml) builder.Body("Well hello there from Xam.Messaging.Plugin"); return builder; }