Sending e-mail is it so simple ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

would like to send messages from my vb application with the user default mail software. That's to say preparing content, attachement and let user selecting the "to" option with it's own friends list. I had a close look to this community and web pages but I'm not really sure to find what I wanted
I do not want to use outlook, as perhaps it's not the user mail software, I want to use default user software, not knowing it
I do not want to use system.web.mail as I do not want to send directly the mail and don't know the smtp server. I want the user to select the destination like with a normal mail
MAPI does want I want but when I install the soft on another pc, I get a "no license for this class" message which seems to be a known problem and has no real good solution (but this would be the solution closest to my needs !)
I didn't spent time to cdo as I spent already much time and would prefer to know before if it the good way to look at
and finally, I'm wondering also about sendto objec
So... what will be your ideas for something which seemed to me simple at the beginning...
 
Thanks for the rply. I just wanted to include a few lines to send an email, like it was possible with VB6& Mapi and the 3,5 Meg of indysocket.dll seems a bit heavy for that. Furthermore, what seems to me the more interesting is to use the default mail client of the user, in order to let him select the mail adress by in its own list

I would prefer to find how application like Word does with it's file/"send to" as attachment command to open a mail with a joined file.
 
You can try this, this is the easiest method to use the standare email
client, however attachments should be attached by the client by hand because
for that is not method to do it programly.

I hope this helps?

Cor

\\\Question is of sSubject and sMessage has to be with UrlEncode, at me it
goes wrong with and for Herfried it goes wrong without so that should me
tried.

'A reference to System.Web may be necessary
'in the Project for this Import to work.
Imports System.Web.HttpUtility

Public Sub StartDefaultMail (sTo As String, _
Optional sSubject As String = "", _
Optional sMessage As String = "")
Try
sTo = UrlEncode (sTo)
sSubject = sSubject
sMessage = sMessage
Process.Start ("mailto:" & sTo & "?subject=" _
& sSubject & "&body=" & sMessage)

Catch e As Exception
MsgBox ("Couldn't start default email application" _
& vbCrLf & e.Message)
'or
Throw New Exception ("Couldn't start default email app", e)
End Try
End Sub
///
 
* "Cor Ligthert said:
Public Sub StartDefaultMail (sTo As String, _
Optional sSubject As String = "", _
Optional sMessage As String = "")
Try
sTo = UrlEncode (sTo)
sSubject = sSubject
sMessage = sMessage
Process.Start ("mailto:" & sTo & "?subject=" _
& sSubject & "&body=" & sMessage)

I still think that 'sSubject' and 'sMessage' should be encoded too.

;-)
 
Yes, thanks, it's an easy method but as you pointed at, it's not possible to attach a file. And the line.length seems to be limited to about 2000 chars. I still wonder how soft like word does (send as attachment is exactly what I would like to reproduce).
 
Back
Top