views:

52

answers:

2

Hi,

I am trying to send mail with large size attachment of 2MB. But sending mail fails.(Sending to Google Apps) as:

MailItemEntry[] entries = new MailItemEntry[1];
String EmlPath = "C:\\testemail.eml";                                        
String msg = File.ReadAllText(EmlPath);
entries[0] = new MailItemEntry();
entries[0].Rfc822Msg = new Rfc822MsgElement(msg);

Exception I am getting while migrating this EML to Google apps is: {"The request was aborted: The request was canceled."}

+1  A: 

According to the Java Mail API Page the size limit for an email message (including attachments) is 1MB.


Edit: updates...

From what I could see, 1 MB is their hard and fast limit...doesn't matter whether you are paying them or not. (However, I may be wrong, you might want to contact customer service about that.) As an alternative however, you might try to find an API that will upload files to a free file upload service (just at a glance, I found this api for uploading to sendspace, although I have no idea how good it is). Then you could include the link that the API would presumably return.

That said, looking more deeply into this, I'm starting to get confused. You have tagged your question Java, and it is for Google App Engine, which uses Java, however you are using File.ReadAllText which as far as I know, is not a Java function, but definitely shows up in the C# documentation.

Also, another thing that confuses me, is that as far as I know, you are not allowed to access the filesystem with Google App Engine, and yet you are not only accessing the filesystem, but accessing a hardcoded absolute path. At the very least, I think that the file that you are using must be inside the war file, but I have not personally used GAE, so I don't know.

Also, the syntax that are using doesn't appear to be the same syntax as I see on the Google App Engine Java Mail Tutorial.

So you may want to look into that.

Edit:

Or much better solution (as suggested by Jason Hall below) to the external file upload API, would be to use the blobstore and email the links to that. (Although that might have problems with quota limits depending upon the number of people you email it to.)

Thomas
Hi: Read the above link provided by you there is a limit of 1MB attachment for Email using Java Mail API(https://code.google.com/appengine/docs/java/mail/overview.html#Quotas_and_Limits) Is there a way to upload email with large size attachments may be by using some other API?
Haseena
@Haseena You can use the App Engine blobstore to store files up to 2GB in size. Then you can just email a link to that file, and have the recipient download it from there. http://code.google.com/appengine/docs/python/blobstore/overview.html
Jason Hall
A: 

Hi:

Sorry for the confusion as i am new to stackoverflow.

I am developing an application in C#.net where i am reading the eml file from application path and then adding the below code

String msg = File.ReadAllText(EmlPath); entries[0] = new MailItemEntry(); entries[0].Rfc822Msg = new Rfc822MsgElement(msg);

I will definately try out the solution suggested by Jason and update you all.

Thanks to all.

Haseena