Hello,
i have problem adding MailAddresses. When i add some MailAddresses to a MailAddressCollection, it happens that some persons have no Mailadress in their profile but if i add them to the MailAddressCollection with: DisplayName as E-Mail I`ll get and the error: Invalid URI: The hostname could not be parsed. at msg.AddAlternateView(app.RequestApointment());
My Problem is that it must be possible to add mailaddress and names (without an @) as attendees, because Outlook will find them automaticly if onyl the name is entered.
Like: test@test.com; Tester, Test;
Here is my Code so far:
// Create attendees of the meeting
MailAddressCollection attendees = new MailAddressCollection();
foreach (string candidates in eMail)
{
// candidates can contain "tester@test.com" or “tester, test”
MailAddress address = new MailAddress(candidates, true);
attendees.Add(address);
}
senderAddress = "tester@test.com";
// Set up appointment
Appointment app = new Appointment(
location, // location of meeting like “Test ü ä ö”
startDate, // start date
endDate, // end date
new MailAddress(senderAddress), // organizer
attendees); // attendees
app.Method = AppointmentMethodType.Publish;
// Set up message that needs to be sent
MailMessage msg = new MailMessage()
// Generate some Reports and export it to PDF
EventDescription report = new EventDescription(userID, Convert.ToInt32(eventID));
MemoryStream mem = new MemoryStream();
report.ExportToPdf(mem);
// Add PDF from Stream to msg
Aspose.Email.Mail.Attachment attachment;
attachment = new Aspose.Email.Mail.Attachment(mem, “some.pdf”);
msg.Attachments.Add(attachment);
msg.From = senderAddress;
msg.To = "test@terst.com";
msg.Subject = mailSubject; // Like “test ä ü ö”
msg.Body = mailBodyPlain;
// Add meeting request to the message
msg.AddAlternateView(app.RequestApointment());
// Save msg as Stream for Responds
Stream ms = new System.IO.MemoryStream();
msg.Save(ms, MailMessageSaveType.OutlookMessageFormat);