EWS: How to upload attachment first before sending an email? - c#

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

Related

Cannot access file when sending email through SMTP server in C#

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!

Sync sent mail with Sent folder

I need to sync sent mails with the sent folders of mail servers, for the users to see at future moments. I can send mails using all these 3 ways, SMTP, CDO and Microsoft Outlook Object(MOO); out of which I can only see my sent mails with MOO. Now the problem is, Not all clients are using outlook, and thus its more impractical to use this.
Out of exercise, I had also used MAPI to send mails, but that don't send HTML body. Also I looked over this topic Microsoft Sent folder, but that don't solve my problem.
So is there anyway, I can send mail with HTML body and sync the sent mail with Sent Folder. ?
Thanks.
You can do that with Extended MAPI (C++ or Delphi), but you probably mean Simple MAPI.
If you are connecting to an Exchange mailbox, EWS is another option.

Parsing emails and attachments

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.

how to create a SMTP server

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.

EMAIL from web server

We have a website sending mail alerts to end users. The site has been developed in c# ASP.NET.
I want to find the best way to send the email alerts to my users. Making sure the mail is not trapped in any spam filters. I read on the internet it is best to sent the mail directly from the web server and not route via an SMTP mail service such as google apps or Postini.
Can anyone tell me if this is correct?
First of all
Making sure the mail is not trapped in
any spam filters
Is not possible - otherwise spammers would do this. You just have to make sure you're domain isn't associated with any spamming activities and watch for keywords within the email.
I read on the internet it is best to
sent the mail directly from the web
server and not route via an SMTP mail
service such as google apps or
Postini.
This point doesn't make sense - your e-mail will never be delivered if it doesn't get routed via an SMTP server, the average message will pass through multiple on its route to the recipient.
The answer is to not actually send email and let someone else deal with the problem. I'd look at postmark or Amazon's simple email service.
We had problems that mails sent with local server often get trapped in spam filters until we implemented SPF on our mail server.
http://en.wikipedia.org/wiki/Sender_Policy_Framework
But I am not admin, that's just what our admin said, and after that we have no problems anymore.
btw. maybe would be better to ask on serverfault.com

Categories

Resources