Hi, I am having a hard time “hacking” the SendEmail node.
source here -> https://github.com/vvvv/vvvv-sdk/blob/develop/vvvv45/addonpack/src/nodes/plugins/Network/Email/Nodes/SendEmailNode.cs
The problem is, the node locks files that are fed into as attachment and i can not delete or overwrite these files after sending the mail anymore.
I found help on stack overflow for this problem but with my limited c# knowledge i am failing at making it work. It is just a little snippet to dispose these files:
foreach (Attachment Attachment in mail.Attachments)
I tried to put it straight into the “finally” section (at line 166)(what makes most sense to me), but the mail object is not known there in that context :( Any hint what i can do to make it work somehow?
try moving line120 (where mail is created) before the try() block. then the object will be known in finally().
yes that did the trick:) thanks!
supa, now please make this a pullrequest!
haha, i was bit rash. the node compiles now with no errors, but the dispose is not working:(
tty says: System.ObjectDisposedException: Auf eine geschlossene Datei kann nicht zugegriffen werden.
The success pin turns true (thats what fooled me to believe it works) but no mail is sent due to the exception.
So now i am pretty much at the beginning again…
To me it seems there is already taken care of disposing the whole thing alltogether somehow. When i try to dispose anything, i get the error about the file beeing closed already or the resource beeing released already.
Also with the “using” keyword like this on the attachment code directly, gives me the same error:
using (Attachment Attachment = new Attachment(filename))
ContentDisposition Disposition = Attachment.ContentDisposition;
Disposition.Inline = false;
This should dispose the stuff right away after the code wents through (at least the internet says so;)
Can it be the plugin is not locking, but the files beeing still locked by vvvv itself somehow? Is this possible? I am about to give up… :(
To receive notification when the e-mail has been sent or the operation has been canceled, add an event handler to the SendCompleted event. You can cancel a SendAsync operation by calling the SendAsyncCancel method.
in the remarks section here: https://msdn.microsoft.com/en-us/library/x5x13z6h(v=vs.110).aspx
since this is sending async you probably have to wait for that operation to complete before you can dispose the attachment…