public void SendMessage(EmailMessage pMessage) { EmailService.EmailServiceClient lClient = new EmailService.EmailServiceClient(); lClient.SendEmail( new EmailService.EmailMessage() { Message = pMessage.Message, ToAddresses = pMessage.ToAddress, Date = DateTime.Now } ); }
public ActionResult <string> Get(int id) { var host = _configuration["ServiceUrl:EmailGrpc"];//127.0.0.1:5001 Channel channel = new Channel(host, ChannelCredentials.Insecure); var client = new EmailService.EmailServiceClient(channel); var reply = client.SendEmail(new Messages.EmailGrpcService.SendEmailRequest { Address = "*****@*****.**" }); channel.ShutdownAsync().Wait(); return("xong"); }
private void SendEmail(string pdfPath, string to, string folder) { using (var email = new EmailService.EmailServiceClient()) { email.SendEmail("Registro de Cliente", new EmailService.EmailDto { Tok__BackingField = new string[] { to }, Bodyk__BackingField = string.Format("Aqui está o email com as informações do seu cadastro. \n" + "Segue o link para download dos arquivos {0}", ConfigurationManager.AppSettings.Get("serverPath") + folder), //"Aqui está o seu email com as informações do cadastro", Subjectk__BackingField = "Informações do Cadastro", Attachmentk__BackingField = new EmailService.AttachmentDto { _content = System.IO.File.ReadAllBytes(pdfPath), _filename = new FileInfo(pdfPath).Name } }); } }
protected void SubmitBtn_Click(object sender, EventArgs e) { // Collect all check box list items from the 'ICU will fund the following' // check box list group into one string string IcuWillFundChoosenItems = ""; foreach (ListItem li in IcuWillFund.Items) { if (li.Selected) { IcuWillFundChoosenItems = IcuWillFundChoosenItems + li.Value + ", "; } } // Collect all check box list items from the 'Please select an invitation option' // check box list group into one string string InviteOptionChoosenItems = ""; foreach (ListItem li in IcuWillFund.Items) { if (li.Selected) { InviteOptionChoosenItems = InviteOptionChoosenItems + li.Value + ", "; } } //Send request e-mail string emailMsgBody; //Format the e-mail message with a HTML table emailMsgBody = "<html><header></head><body>"; emailMsgBody = emailMsgBody + "<table width='650' border='1' cellpadding='5' cellspacing='0' >"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td width='265' valign='top'><strong>Your name:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + RequestorName.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top' width='265'><strong>Your e-mail address:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + RequestorEmail.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>Requested speaker:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + RequestedSpeaker.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>Requested speaking topic:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + RequestedSpeakingTopic.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top' width='265'><strong>Chapter and/or Association:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + ChapterAssociation.SelectedItem.Text + " " + ChapterAssociationOther.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td rowspan='2' valign='top'><strong>Chapter/Association location:</strong></td>"; emailMsgBody = emailMsgBody + "<td>City:</td>"; emailMsgBody = emailMsgBody + "<td width='425'>" + ChapterAssociationCity.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td width='110'>State:</td>"; emailMsgBody = emailMsgBody + "<td>" + ChapterAssociationState.Text + "</td>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>Is this part of a local chapter or association meeting? </strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + ChapterLocalMeeting.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>Is there a table-top or exhibit opportunity?</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + ExhibitOpportunity.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td rowspan='5' valign='top'><strong>Chapter/Association contact: </strong></td>"; emailMsgBody = emailMsgBody + "<td>Facility:</td>"; emailMsgBody = emailMsgBody + "<td>" + AssociationContactFacility.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td>Name:</td>"; emailMsgBody = emailMsgBody + "<td>" + AssociationContactName.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td>Title:</td>"; emailMsgBody = emailMsgBody + "<td>" + AssociationContactTitle.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td>Phone:</td>"; emailMsgBody = emailMsgBody + "<td>" + AssociationContactPhone.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td>E-Mail:</td>"; emailMsgBody = emailMsgBody + "<td>" + AssociationContactEmail.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td rowspan='3' valign='top'><strong>Proposed date(s):</strong></td>"; emailMsgBody = emailMsgBody + "<td>Date Option 1:</td>"; emailMsgBody = emailMsgBody + "<td>" + ProposedDate1.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td>Date Option 2:</td>"; emailMsgBody = emailMsgBody + "<td>" + ProposedDate2.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td>Date Option 3:</td>"; emailMsgBody = emailMsgBody + "<td>" + ProposedDate3.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>Purposed time: </strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + ProposedTime.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>Number of expected attendees:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + ExpectedAttendees.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>ICU will fund the following:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + IcuWillFundChoosenItems + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>If a venue is needed, please recommend 2-3 possible locations:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + VenueRecomnd.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>Will continuing education credits be provided?</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + CEcredits.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>Please select an invitation option:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + InviteOptionChoosenItems + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "<tr>"; emailMsgBody = emailMsgBody + "<td valign='top'><strong>Additional comments:</strong></td>"; emailMsgBody = emailMsgBody + "<td colspan='2'>" + Comments.Text + "</td>"; emailMsgBody = emailMsgBody + "</tr>"; emailMsgBody = emailMsgBody + "</table>"; emailMsgBody = emailMsgBody + ""; emailMsgBody = emailMsgBody + "</body></html>"; EmailService.EmailServiceClient es = new EmailService.EmailServiceClient(); es.SendMail(ManagerEmail.Value, RequestorName.Text, RequestorEmail.Text, emailMsgBody, "KOL Speaker Request", "MarketingRequestForms"); Response.Redirect("submit-success.aspx"); }
private void SendEmail() { //Email EmailService.EmailServiceClient obj = new EmailService.EmailServiceClient(); obj.SendEmailCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(obj_SendEmailCompleted); obj.SendEmailAsync(MessageData.Name, MessageData.ToAddress, MessageData.FromAddress, MessageData.Phone, MessageData.Comment); MessageData = new MessageData(); }