public void send(String sender_email, String sender_pass, String receiver_email) { bool ok = false; String col = "", val = ""; DataTable dt = new DataTable(); MailMessage mail = new MailMessage(); mail.From = new MailAddress(sender_email); /// sender of email report mail.To.Add(receiver_email); /// receiver of the email report mail.Subject = "Daily Report"; mail.Body = "Here is your Sales report of this day " + date_today; //https://myaccount.google.com/lesssecureapps?pli=1 mail.Attachments.Add(new Attachment("\\\\RIGHTAPPS\\RightApps\\BALAI\\101B_cashier_" + export_filename + ".pdf")); inc_pbar(10); using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587)) { smtp.Credentials = new NetworkCredential(sender_email, sender_pass); // sender email and password smtp.EnableSsl = true; try { smtp.Send(mail); ok = true; } catch (Exception ex) { ok = false; MessageBox.Show(ex.Message); } } inc_pbar(10); String details = " Email Sent to: " + receiver_email + "Time: " + DateTime.Now.ToString("h:mm tt") + " Date: " + DateTime.Now.ToString("yyyy-MM-dd"); col = "identity,details"; val = "'" + receiver_email + "','" + details + "'"; db.InsertOnTable("auto_log", col, val); }