Programmatically send e-mail
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Programmatically send e-mail
In the viewer is present a button "Send e-mail", that creates an e-mail with the choosen attachment type. How can i do this by code? Do you expose a method, something like "CreateMailWithPdfAttachment"?
Thanks.
Thanks.
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Programmatically send e-mail
Ok, i think i have found the classes:
Stimulsoft.Report.Export.MAPI
Stimulsoft.Report.Export.MapiMessage
Stimulsoft.Report.Export.MapiFileDesc
but i haven't found how to do this task: i have a serialized report that i need to export as a pdf and then attach it to an email presetting the recipients, the subject and the body, without making appear the email client interface.
I know how to export to pdf, i don't know how to attach the pdf to an email using your MAPI class.
Thanks.
Stimulsoft.Report.Export.MAPI
Stimulsoft.Report.Export.MapiMessage
Stimulsoft.Report.Export.MapiFileDesc
but i haven't found how to do this task: i have a serialized report that i need to export as a pdf and then attach it to an email presetting the recipients, the subject and the body, without making appear the email client interface.
I know how to export to pdf, i don't know how to attach the pdf to an email using your MAPI class.
Thanks.
Programmatically send e-mail
Hi Fabio,
Maybe the following thread may be of some help:
http://forum.stimulsoft.com/Default.aspx?g=posts&t=499
Maybe the following thread may be of some help:
http://forum.stimulsoft.com/Default.aspx?g=posts&t=499
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Programmatically send e-mail
It doesn't seem to help, because i have to do this programmatically, without viewer and user interaction.
Thanks.
Thanks.
Programmatically send e-mail
You can use following way:
1. You need create pdf file for attaching to email message. Use method report.ExportDocument. For example:
2. You need use MailMessage object. For example:
You can read more about sending email with attachments at:
http://msdn2.microsoft.com/en-us/librar ... ments.aspx
Thank you.
1. You need create pdf file for attaching to email message. Use method report.ExportDocument. For example:
Code: Select all
string file = "report.pdf";
report.ExportDocument(file);
Code: Select all
MailMessage message = new MailMessage();
SmtpMail.SmtpServer = "mail.domain.com";
message.Priority = MailPriority.High;
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "email@domain.com");
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mypassword");
Attachment data = new Attachment(file, MediaTypeNames.Application.Octet);
message.Attachments.Add(data);
SmtpMail.Send(message);
http://msdn2.microsoft.com/en-us/librar ... ments.aspx
Thank you.
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Programmatically send e-mail
Your solution doesn't consider the use of the default email client: i need to save in it the emails sent.
What i wanted to do was to create an email in the default email client, just like you do when in the viewer the user presses "Send email" button, but without opening the email client interface.
To simulate what the viewer does when the user presses "Send email" i could already use the method:
Stimulsoft.Report.Export.MAPI.SendEMail
This method has the following parameters:
"Subject"
"Body"
"FilePath"
I think that this method should have these other parameters:
"Recipient"
"Cc"
"Bcc"
"ShowComposer"
The ShowComposer method instructs if the user interface must appear or not.
The limitation would be that a single file would be allowed as an attachment, just like now (you may think to accept file names separated by ";").
May you do something for this suggestion?
Thanks.
What i wanted to do was to create an email in the default email client, just like you do when in the viewer the user presses "Send email" button, but without opening the email client interface.
To simulate what the viewer does when the user presses "Send email" i could already use the method:
Stimulsoft.Report.Export.MAPI.SendEMail
This method has the following parameters:
"Subject"
"Body"
"FilePath"
I think that this method should have these other parameters:
"Recipient"
"Cc"
"Bcc"
"ShowComposer"
The ShowComposer method instructs if the user interface must appear or not.
The limitation would be that a single file would be allowed as an attachment, just like now (you may think to accept file names separated by ";").
May you do something for this suggestion?
Thanks.
Programmatically send e-mail
Sorry, but we can not to enhance ability of our engine in that direction. In that case you should to use the Simple MAPI in your Application. As a base for that you may use use our MAPI class. We can send it for you if necessary.
Thank you.
Thank you.
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Programmatically send e-mail
Yes, send it to me, thanks.
Programmatically send e-mail
The class was sent to the e-mail which was specified by you during the registration on the forum.
Thank you.
Thank you.
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Programmatically send e-mail
Received, thank you.