Showing posts with label start selenium server. Show all posts
Showing posts with label start selenium server. Show all posts

Sending email with attachments from C#


In many cases you may required to send emails using ASP.NET. You can have all the classes required to send an email in the System.Net.Mail namespace. You can send an email from ASP.NET as follows :

First you have to add these namespaces to your code behind file:

1. using System.Net;
2. using System.Net.Mail;

Then write the following method

public void email_send()
{
    MailMessage mail = new MailMessage();
    SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
    mail.From = new MailAddress("your [email protected]");
    mail.To.Add("[email protected]");
    mail.Subject = "Test Mail - 1";
    mail.Body = "mail with attachment";

    System.Net.Mail.Attachment attachment;
    attachment = new System.Net.Mail.Attachment("c:/textfile.txt");
    mail.Attachments.Add(attachment);

    SmtpServer.Port = 587;
    SmtpServer.Credentials = new System.Net.NetworkCredential("your [email protected]", "your password");
    SmtpServer.EnableSsl = true;

    SmtpServer.Send(mail);

}

Using the above you can send attachemebts also. Hope this helps :-)
Read more...

No connection could be made because the target machine actively refused it 127.0.0.1:4444

I had this issue and it took a lot of time to find the solution for this. I searched many sites for the solutions. After few hours, i have found the solution for this issue. (This is the solution which worked for me . I hope this will work for others also.)

The problem is i din't start the selenium server. After starting the server, issue gone and all worked fine.

You can download selenium server here. Download Selenium server

After downloading start the selenium server. See screen shot below


Read more...