I have been able to successfully send an email message using the System.Net.Mail objects (MailMessage and SmtpClient). My problem is that when I try to add an attachment it doesn't recognize the Add method for the Attachments collection. This is supposed to exist according to the MSDN documentation.
I am try to use the following code:
mailMessage:Attachments:Add(new System.Net.Mail.Attachment("something.pdf")).
but I get:
Could not locate element 'Add' in class
'System.Net.Mail.AttachmentCollection'
Sure enough if I look in the class browser Add isn't in there. I double checked to make sure that I was looking at the right MSDN documentation for the .Net Framework 3.0 and I was, so I'm stuck.
Are there methods that aren't exposed in the ABL? Any ideas would be appreciated.
mailMessage:Attachments:Add(new
System.Net.Mail.Attachment("something.pdf")).
but I get:
Could not locate element 'Add' in class
'System.Net.Mail.AttachmentCollection'
Sure enough if I look in the class browser Add isn't
in there. I double checked to make sure that I was
looking at the right MSDN documentation for the .Net
Framework 3.0 and I was, so I'm stuck.
Are there methods that aren't exposed in the ABL? Any
ideas would be appreciated.
I believe the Add() method takes a generic as an argument - which aren't supported in the ABL. There are a couple of posts in this forum discussing that.
You can see that from the Add method (http://msdn.microsoft.com/en-us/library/ms132404.aspx) to the Collection (http://msdn.microsoft.com/en-us/library/ms132397.aspx).
-- peter
As an alternative maybe you can manipulate the headers and content to send the attachment?
It's a little annoying that the MailMessage:To collection is accessible and Attachments isn't....of course that's not Progress' fault...but darn it!
The MailAddressCollection has two versions of Add. One of them expects at String, this one is accessible by Progress. The AttachementCollection just has the Add for the generic type. So nothing accessible from Progress.
collection is accessible and Attachments isn't....of
course that's not Progress' fault...but darn it!
That's a very friendly comment for a missing feature (support for generics) in the ABL Hopefully a future release will include support for generics.
The early beta testers have completely overseen the lack of support for generics...
Well, I am pretty bummed out about it but I don't want to be rude
As an alternative maybe you can manipulate the
headers and content to send the attachment?
Sorry, I don't have a lot of experience with manipulating emails. I'm not sure what you mean.
Well, instead of using for example the property "IsBodyHtml" you could theoretically set the internet header.
And maybe the same goes for attachments...
mail = NEW MailMessage().
mail:Headers:Set("Content-Type", 'multipart/mixed').
Or you could switch to something like smtpmail.p...
So you're thinking that I could put the attachment in the body? I'll definitely play with it before I just go back to using create "outlook.application" ...
Theoretically I think that should be possible, but I don't know how "intelligent" System.Net.Mail behaves (something like "you should use the attachment methods so we strip all header/body information regarding attachments").
Sorry to leave this thread open for so long everyone. I got distracted away from this project I forgot I left it hanging.
Anyway, for the sake of speed I just ended using the outlook.application objects to get it done. Thanks again everyone.