Open default e-mail client with attachments.

  • Thread starter Thread starter Gama Franco
  • Start date Start date
G

Gama Franco

Hi,

I'm working on a project based in Windows Forms, and I need to open
the user's default e-mail client (a new e-mail) with some attachments
ready to send. Since the destination of the e-mail is unknow at this
point I can't send it using the SmtpMail.Send() method. And because of
the attachments I'm not able to open the new e-mail using the
"mailto:" technique.

Is there any other way to solve this problem keeping in mind that the
user may not be using Outlook as his default e-mail client?

Best regards,
Gama Franco
 
Gama,

Why not query the user the address they want to send it to, and then use
the SmtpMail class?

If the email applications support MAPI, then you can probably access any
of them through that interface. However, it might require a good deal of
calls through either COM interop on your part, or the P/Invoke layer to
access the API.

Hope this helps.
 
Hi Nicholas,

Thank you very much for the tip.

I've developed the code and my application can already open the
Outlook window with the attachment on it. The stupid thing is that, in
order to send the e-mail I need to press the Alt+s keys, since the
send button does nothing.

I'm using Outlook 2003, is it a bug or am I missing something?

Best regards,
Gama Franco

Nicholas Paldino said:
Gama,

Why not query the user the address they want to send it to, and then use
the SmtpMail class?

If the email applications support MAPI, then you can probably access any
of them through that interface. However, it might require a good deal of
calls through either COM interop on your part, or the P/Invoke layer to
access the API.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Gama Franco said:
Hi,

I'm working on a project based in Windows Forms, and I need to open
the user's default e-mail client (a new e-mail) with some attachments
ready to send. Since the destination of the e-mail is unknow at this
point I can't send it using the SmtpMail.Send() method. And because of
the attachments I'm not able to open the new e-mail using the
"mailto:" technique.

Is there any other way to solve this problem keeping in mind that the
user may not be using Outlook as his default e-mail client?

Best regards,
Gama Franco
 
hi gama i was trying below code. it works fine. i was trying to attach
files but it is not attached. so if any suggestion then pls reply me on
my below email address.
thanks in advance
john
my email address = (e-mail address removed)

----------------------------code----------------------------


Mystring.Append("mailto:");
Mystring.Append("&Subject=Finance profit and loss&body=this is test
body");
Mystring.Append("&attach=c:\\test\\test.txt");
Process myProcess = new Process();
myProcess.StartInfo.FileName = Mystring.ToString();
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.RedirectStandardOutput=false;
myProcess.Start();
myProcess.Dispose();
*/
 
Back
Top