I am having an issue when sending emails in C#.
I have an application for sending emails with attachment through our own SMTP server. But before sending the emails, there is another function for creating/merging PDF files. Sometimes it says "can not access file".
I understand that this could be the PDF file is not created yet. The pdf file size is dynamic so it may take different time to finish the creation.
I am wondering if there is a general solution for this? Such as I am sending a request to the server to create PDF files and how can I wait the PDF file to finish?
Thanks in advance!
Related
I'm trying to send an email from my wcf service. Sending email works fine, but sending email with a pdf as attachment doesn't work at all. I get an OutOfMemoryException at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement). The image is loaded from an url and included in the pdf.
I've read that OutOfMemoryException doesn't have to be that the application is running out of memory. But I have another almost identical wcf service on the same windows server that works fine. The only difference with that service is the address to the server. (It's located at a subdomain) and it uses another smtp address when sending emails.
Can the problem be because the IIS site or application pool is configurated wrong? And if so, how do I solve it?
Otherwise I have no idea why it's not working.
Any ideas? Please help.
I have a requirement to parse email messages and upload the email into DB based on certain filters. I have experience writing outlook add-in and it is possible to do this in client side.
But here i think i need to write some plugin in exchange server and parse the email messages there itself. is my assumption right? if so please point me to some tutorial for writing exchange server plugins.
You could probably use my MimeKit library to parse the messages.
I have an application that run on server,
I want that my application could received mail in order to start some function.
I would like to know what should I need to do in order to have this capability?
Do I need to build SMTP server? if so, how should I do it?
You can try: http://www.lumisoft.ee/lsWWW/download/downloads/ .
There is SMTP server component what you can use to recieve emails.
Or alternatively there is SMTP server written in C#, you can write message filter for server.
In filter you can access incoming message and do what ever you want with it.
--- Yes also as others suggested will work ok too, you just run simple mail server and get emails by pop3 or imap. Pop3 and Imap components and example applications also included in same link.
You can use IIS6 to receive email and drop it into a specified folder. Your app can then pick up those emails and do whatever it needs to with them.
Active the SMTP service in IIS. It drops emails in the C:\inetpub\smtproot\drop folder IIRC.
Then you just need a Mime parser to read the EML files. I used the one in Lumisoft when I did the same thing.
You could use any Mailserver to receive the mail and have your application check the poxtbox every 1 minute to receive the mails.
When any mail arrived (or special subject as you need), you could execute your code.
For IMAP you could look at this Library
I have previously had some success using the Chilkat POP3 component to programmatically monitor a POP3 account for incoming mail.
I use Exchange Web Service API to do sending email. It is very easy to add attachments by just writing
message.Attachments.AddFileAttachment(attachmentname);
The problem is attaching process happens in sending process. I found that yahoo, gmail and hotmail they all uploading attachmetns first before you sending the mail. How to do so?
It's the EWS Managed API which does this uploading and sending in one process. But in the background, multiple requests are made to the Exchange server:
Create the message in the Drafts folder of your mailbox
Upload the attachments
Send the items.
If you want to, you can do this yourself. But I don't see the point in doing that. What do you want to accomplish?
If you notice, GMail for example does not use the same manner of attachment. For instance, when you attach something, I am guessing the files get uploaded to some server and then they just provide you with a Link for the download. So I think you can upload the file to some server (be it FTP, or just a database) and then just add the links to the download of the files in the body of the email.
Good luck. I will be looking into the thread to see if there is in fact a way to do this.
Hanlet
I am sending a mail using SMTP server in C# from my application. Whether the mail is delivered or not to the recipient, i need the response to our application.
How it can be done using C#???
You can not find out whether an email has been delivered, there is no mechanism for this in smtp. The best you can do is know whether the email has been sent successfully, which (presuming you are using System.Net.Mail.SmtpClient) you can tell by the fact that that the Send method throws an exception.
Spammers try to get around this limitation by using HTML mail and putting a link to an image on their server with a unique URL. IF this URL gets hit then you know someone has opened then email. This is somewhat frowned upon and highly unreliable as most email applications block linked images by default.