I have simply question. Is it possible to send new message directly to specific IMAP folder using mailkit?
I previously used S22.Imap which work flawlessy but this library have strange issue with message body, it adds random carriage return sign to plain body text.
In s22.imap this function is
client.StoreMessage(MyMailMessage, False, box)
Where client is IMAP client, MyMailMessage is net.Mail.MailMesssage and box is IMAP folder.
I don't want to send message to server and again recieve it te get unique uuid and finally move it to specific folder. Maybe is better way to do this. Thank you in advance for help.
Yes, literally everything is possible to do with MailKit :)
client.Inbox.Append (message);
That will append the message to the Inbox.
Same API exists for any other folder as well.
Related
After downloading mail from using MailBee.NET library, unread mails in the user'
s mailbox also mark as read. Is there a workaround for this.?
No need to make extra method call (imap.SetMessageFlags) to reset seen messages back to unseen.
Simply set imap.SetSeenForEntireMessages property to false before downloading emails.
Used map.SetMessageFlags Method. It works
https://afterlogic.com/mailbee-net/docs/MailBee.ImapMail.Imap.SetMessageFlags_overload_1.html
I'm working on an issue to my project that when I click the button, a default email client should pop out and if there's an attachment, it should be automatically attach to the default email client like this.
I already tried a lot of methods how to do this. First I used MAPI, but the MAPI cannot detect my Default Email Client even though I already set it in Control Panel, It shows this two message box
I already searched the internet about those error but there's no definite or clear answer to me. HERE'S the code I used in MAPI.
I used also the mail:to protocol to call the default email client who's handling to the aforementioned protocol with using this line of codes.
Dim proc As System.Diagnostics.Process = New System.Diagnostics.Process()
Dim filename = Convert.toChar(34) & "C:\USERS\JOSHUA~1.HER\DOWNLO~1\ASDPOR~1.PDF" & Convert.toChar(34)
Debug.Writeline(filename)
Dim asd As String = String.Format("mailto:someone#somewhere.com?subject=hello&body=love my body&Attach={0}", filename)
proc.StartInfo.FileName = asd
proc.Start()
But still, no luck. I read a thread that the mail:to don't handle attachment anymore, but this line of code opened my default email client with body and subject, but there's no attachment. In terms of the filename variable, I already tried every path format, I read that I should use 8.3 path format. But still doesn't work.
The last method I used is extending the System.Net.MailMessage.MailMessage() following THIS answer. This works in terms of opening the default email client and attaching an attachment to a mail, but this is not editable and there's no send button on the default email client because this line of code just generating an .eml file and opening it. I'm thinking of parsing the eml file but still I don't know how to open the default email client progmatically in a new message form. Here's the photo
You guys have any idea how to make this possible? Thanks!
I am afraid that this will not be possible to do using some generic method for any mail client. But you can easily create your own solution using System.Net.Mail.SmtpClient and some simple custom UI.
Currently, I have an email application and I want to add send messages with .eml but not as attached file without from, to content. I don't know where to start. My first idea was extract message from .eml file and return CDO message.
It would be possibly looking at the OpenPop.NET library (http://hpop.sourceforge.net/). MIME parsing is included and, as far as I can remember, functioned OK for me once. I have the impression that this is what you are looking for.
In my application, i send mails to managers from program automatically. Normally it works good, but when i use program on another computer, it sends mail automatically but file type is not PDF. File type is File and name of pdf is =utf-8BQU5HT1JBIEhBTEkgQS7Fni4gR8OcTkzD. I also checked source codes. But I couldn't understand what is wrong with that. Any idea what to do?
Try to fill the ContentDisposition, example is here:
Sending email with attachments from C#, attachments arrive as Part 1.2 in Thunderbird
Maybe, in the code you can change the MediaTypeNames.Application.Octet to MediaTypeNames.Application.Pdf
I hope, this helps!
One of the requirements for the application that I'm working on is to enable users to submit a debugging report to our helpdesk for fatal errors (much like windows error reporting).
I've been told that e-mails must come from a client's mail account to prevent the helpdesk getting spammed and loads of duplicate calls raised.
In order to achieve this, I'm trying to compose a mail message on the server, complete with a nice message in the body for the helpdesk and the error report as an attachment, then add it to the Response so that the user can download, open and send it.
I've tried, without success, to make use of the Outlook Interoperability Component which is a moot point because I've discovered in the last 6 hours of googling that creating more than a few Application instances is very resource intensive.
If you want the user to send an email client side, I don't see how System.Net.Mail will help you.
You have two options:
mailto:support#domain.com?subject=Error&body=Error message here...
get user to download email in some format, open it in their client and send it
Option 1 will probably break down with complex bodies. With Option 2, you need to find a format that is supported by all mail clients (that your users use).
With option 1, you could store the email details locally on your server against some Error ID and just send the email with an Error ID in the subject:
mailto:support#domain.com?subject=Error 987771 encountered
In one of our applications the user hits the generate button and it creates and opens the email in outlook. All they have to do is hit the send button. The functions is below.
public static void generateEmail(string emailTo, string ccTo, string subject, string body, bool bcc)
{
Outlook.Application objOutlook = new Outlook.Application();
Outlook.MailItem mailItem = (Outlook.MailItem)(objOutlook.CreateItem(OlItemType.olMailItem));
/* Sets the recipient e-mails to be either sent by 'To:' or 'BCC:'
* depending on the boolean called 'bcc' passed. */
if (!(bcc))
{
mailItem.To = emailTo;
}
else
{
mailItem.BCC = emailTo;
}
mailItem.CC = ccTo;
mailItem.Subject = subject;
mailItem.Body = body;
mailItem.BodyFormat = OlBodyFormat.olFormatPlain;
mailItem.Display(mailItem);
}
As you can see it is outputting the email in plaintext at the moment because it was required to be blackberry friendly. You can easily change the format to HTML or richtext if you want some formatting options. For HTML use mailItem.HTMLBody
Hope this helps.
EDIT:
I should note that this is used in a C# Application and that it is referencing Microsoft.Office.Core and using Outlook in the Email class the function is located in.
The simple answer is that what you are trying to achieve isn't realistically achievable across all platforms and mail clients. When asked to do the improbable it is wise to come up with an alternative and suggest that.
Assuming that your fault report is only accessible from an error page then you've already got a barrier to spam - unless the spammers can force an exception.
I've always handled this by logging the fault and text into the database and integrating that with a ticketing system. Maybe also have a mailto: as Bruce suggest with subject=ID&body=text to allow the user to send something by email.
I don't think an .eml format file will help either - because they'll need to forward it, and most users would probably get confused.
A .eml is effectively plain text of the message including headers as per RFC-5322.