How to send screenshot to any mail recipient using selenium - email

How can I send any screenshot captured using selenium web driver to a mail recipient?

In c# you can use
using Outlook1=Microsoft.Office.Interop.Outlook;
Add reference of Above
Outlook1.Application outlookApp1 = new Outlook1.Application();
Outlook1.MailItem mailItem = (Outlook1.MailItem)outlookApp1.CreateItem(Outlook1.OlItemType.olMailItem);
outlookApp1.CreateItem(Outlook1.OlItemType.olMailItem);
mailItem.Subject = "Your subject";
mailItem.To = "Email id";
mailItem.Importance = Outlook1.OlImportance.olImportanceLow;
mailItem.Display(false);
mailItem.Send();
You can even add attachments

Related

how to create an email with that information of an email outlook with python?

good afternoon to all the masters on this topic, the problem is detailed as follows:
1.- I want to extract the information of the last mail that arrives in a specific subfolder
2.- I want to use that information to send in another email without changing the format of the body or the information
3 .- send the new mail
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6).Folders.Item("subfolder")
messages = inbox.Items
message = messages.GetLast()
for message in messages:
if message.unread == True: # gets only 'Unread' emails
subject_content = message.subject
# to store subject lines of mails
body_content = message.body
# to store Body of mails
print(subject_content)
print(body_content)
message.Unread = True # mark the mail as 'Read'
message = messages.GetNext()
print(message)
newMsg = message <================
newMsg.Body = message.body
newMsg.Subject = message.Subject
newMsg.To = "xx#mail.com"
#newMsg.Send()

How to insert data in to database when mail comes in inbox(mail server)

I have a requirement. I have a mail server where user sends mail with there requirement and i need to insert data in my database when mail arrive in mail box. i Have no idea about it. If anybody has any idea please share. Thanks in advance.
Please find the below codes for sending and receiving mails accordingly:
Send Mail
var message = new MailMessage("admin#bendytree.com", "someone#example.com");
message.Subject = "What Up, Dog?";
message.Body = "Why you gotta be all up in my grill?";`enter code here`
SmtpClient mailer = new SmtpClient("smtp.gmail.com", 587);
mailer.Credentials = new NetworkCredential("admin#bendytree.com","YourPasswordHere");
mailer.EnableSsl = true;
mailer.Send(message);
Recieving Mail
client.Connect("pop.gmail.com", 995, true);
client.Authenticate("admin#bendytree.com", "YourPasswordHere");
var count = client.GetMessageCount();
Message message = client.GetMessage(count);
Console.WriteLine(message.Headers.Subject);
You can use this message object for database insertion.

Should I use the GRAPH API or a simple SMTP class to create an email ?

I don't seem to get it. I can create some code to send an email like this:
String userName = "user#domain.com";
String password = "your password";
MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress("ToAddress"));
msg.From = new MailAddress(userName);
msg.Subject = "Test Office 365 Account";
msg.Body = "Testing email using Office 365 account.";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Host = "smtp.office365.com";
client.Credentials = new System.Net.NetworkCredential(userName, password);
client.Port = 587;
client.EnableSsl = true;
client.Send(msg);
Or I can create an app in our Azure AD and set the permissions and send an email with the GRAPH API right?
Is there any possible reason I would want to use the GRAPH API to do this ?
Well you're asking for an opinion, so it's hard to give an all-inclusive answer. However, one reason that you might prefer Graph over SMTP is that it uses OAuth, so you do not need to ask for or store the user's username or password.

AE.net.Mail, How to move mail to a new folder in outlook

How to move mail to a new folder in outlook?
My code:
using (ImapClient ic = new ImapClient(
imapAddr,
myEmailID,
myPasswd,
ImapClient.AuthMethods.Login,
portNo,
secureConn))
{
ic.SelectMailbox("INBOX");
bool headersOnly = false;
Lazy<MailMessage>[] messages = ic.SearchMessages(SearchCondition.Unseen(), headersOnly);
foreach (Lazy<MailMessage> message in messages)
{
MailMessage m = message.Value;
}
}
I try Google it but I can not find it .
Any suggestions are highly appreciated.
to move a message to another folder do this:
ic.MoveMessage(message.Uid, "some existing folder");
The uid is the unique identifiier for the mailmessage. I assume it maps to the message-id as described in RFC for Internet Message Format. Or otherwise to the UNIQUEID in the IMAP protocol.
to create a new folder use the this method:
ic.CreateMailbox("new mailbox name");
To send emails use an SmtpClient, like the one that is supplied in the .net framework:
using(SmtpClient client = new SmtpClient("your smtp server.com"))
{
client.Send("from#example.com",
"to#example.com",
"subject",
"Hello World");
}

How do you send an e-mail from Windows Phone 7?

What's the function for sending e-mails from WP7? I'm trying to set up a button to send feedback e-mail, but I can't find the right function.
Thanks,
Zain
Found it. You need to use the EmailComposeTask class. Here's a sample:
using Microsoft.Phone.Tasks;
...
void SendEmail(){
EmailComposeTask email = new EmailComposeTask();
email.To = "receiver#stuff.com";
email.Subject = "hey";
email.Body = "Wazaaaaaaaaaaap! How you doin?";
email.Show();
}