public void SendEmailWithAttachmentNull() { const string endpointConfigurationName = "EmailPusherService_basicHttpBinding"; IEmailPusherService emailPusher = new EmailPusherServiceClient(endpointConfigurationName); var recipients = new string[1] { "*****@*****.**" }; var response = emailPusher.AddNewMessageWithAttachmentNameGetAddNewMessageResponse(recipients, null, null, "subject", "body", "*****@*****.**"); // user this runs under probably wont hava access to file so error is correct, shows web services is working correctly Assert.That(response.MessageId, Is.GreaterThan(0)); }
public void SendEmailWithAttachments() { const string endpointConfigurationName = "EmailPusherService_basicHttpBinding"; IEmailPusherService emailPusher = new EmailPusherServiceClient(endpointConfigurationName); var recipients = new string[1] { "*****@*****.**" }; var attachments = new string[1] { @"\\pbsw23it\it\1.jpg" }; var response = emailPusher.AddNewMessageGetAddNewMessageResponse(recipients, null, attachments, "subject", "body", "*****@*****.**"); // user this runs under probably wont hava access to file so error is correct, shows web services is working correctly Assert.That(response.ErrorList[0], Is.EqualTo(@"File Doesnt Exist : \\pbsw23it\it\1.jpg")); }
// not a suitable holder in email type for our use of attachment public void SendWithDifferentAttachmentName(RazorEmailResult email, AttachmentType[] attachments) { var sr = new StreamReader(email.Mail.AlternateViews[0].ContentStream); var body = sr.ReadToEnd(); email.Mail.AlternateViews[0].ContentStream.Position = 0; const string endpointConfigurationName = "EmailPusherService_basicHttpBinding"; IEmailPusherService emailPusher = new EmailPusherServiceClient(endpointConfigurationName); Log4NetHelper.Log.Debug("EmailSenderHelper EmailPusherServiceClient Binding : " + endpointConfigurationName); var response = emailPusher.AddNewMessageWithAttachmentNameGetAddNewMessageResponse(email.Mail.To.Select(x => x.Address).ToArray(), email.Mail.CC.Select(x => x.ToString()).ToArray(), attachments, email.Mail.Subject, body, email.Mail.From.Address ); Log4NetHelper.Log.Info("EmailSenderHelper Send Completed For Email : " + string.Join( ";", email.Mail.To.Select(x => x.Address) ) + "messageId" + response.MessageId); }
public void Send(RazorEmailResult email) { var sr = new StreamReader(email.Mail.AlternateViews[0].ContentStream); var body = sr.ReadToEnd(); email.Mail.AlternateViews[0].ContentStream.Position = 0; const string endpointConfigurationName = "EmailPusherService_basicHttpBinding"; IEmailPusherService emailPusher = new EmailPusherServiceClient(endpointConfigurationName); Log4NetHelper.Log.Debug("EmailSenderHelper EmailPusherServiceClient Binding : " + endpointConfigurationName); emailPusher.AddNewMessageGetAddNewMessageResponse(email.Mail.To.Select(x => x.Address).ToArray(), new string[0], new string[0], email.Mail.Subject, body, email.Mail.From.Address ); Log4NetHelper.Log.Info("EmailSenderHelper Send Completed For Email : " + string.Join(";", email.Mail.To.Select(x => x.Address) )); }