Send email from CSharp with Gmail Account

Leave a comment

string gMailAccount = "chem.leakhina@gmail.com";
            string password = "leakhina*147";
            string to = "chem.leakhina@gmail.com";
            NetworkCredential loginInfo = new NetworkCredential(gMailAccount, password);
            MailMessage msg = new MailMessage();
            msg.From = new MailAddress(gMailAccount);
            msg.To.Add(new MailAddress(to));
            msg.Subject = "subject";
            msg.Body = "message";
            msg.IsBodyHtml = true;
            SmtpClient client = new SmtpClient("smtp.gmail.com");
            client.EnableSsl = true;
            client.UseDefaultCredentials = false;
            client.Credentials = loginInfo;
            client.Send(msg);

Sending a fax using Windows Faxing in C#

Leave a comment

Adding a reference to FAXCOMLib.dll (COM/Fax Services) in Windows XP provides access to the Windows Fax Service, which you can use to send a fax as follows:

FAXCOMLib.FaxServer faxServer = new FAXCOMLib.FaxServerClass();
if (FaxNumber != “”)
{
try
{
faxServer.Connect(MachineName);
faxServer.Retries = Retries;
faxServer.RetryDelay = RetryDelay;
FAXCOMLib.FaxDoc faxDoc = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(FileName);
faxDoc.RecipientName = RecipientName;
faxDoc.FaxNumber = FaxNumber;
faxDoc.DisplayName = DocumentName;
int Response = faxDoc.Send();
success = true;
}
catch{}
finally
{
faxServer.Disconnect();
} // disconnect
} // send fax