Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have ran some recorded script using selenium RC in visual studio(c#).

I have reports of those script readily.(i saved all the results in a text file)

Now, i want to send those reports in the form of mail to client through automation.

How to configure those settings and what all things will be required?

All the reports generated should be delivered to client.

Suggest the site or link where example is present.

Also give steps regarding configuration and settings.

Thank you..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
248 views
Welcome To Ask or Share your Answers For Others

1 Answer

This is more C# based than just a Selenium question.

There is an entire website devoted to explaining, in detail, how to send an email using C# and the System.Net.Mail namespace:

http://www.systemnetmail.com/

A simple example:

using System.Net;
using System.Net.Mail;

var fromAddress = new MailAddress("from@gmail.com", "From Name");
var toAddress = new MailAddress("to@example.com", "To Name");
string fromPassword = "fromPassword";
string subject = "Subject";
string body = "Body";

var smtp = new SmtpClient
           {
               Host = "smtp.gmail.com",
               Port = 587,
               EnableSsl = true,
               DeliveryMethod = SmtpDeliveryMethod.Network,
               UseDefaultCredentials = false,
               Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
           };
using (var message = new MailMessage(fromAddress, toAddress)
                     {
                         Subject = subject,
                         Body = body
                     })
{
    smtp.Send(message);
}

All you would need to do is construct the message body by reading in the contents of the 'reports' you mentioned about.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...