Start a Email programm

From my Desktop program should be the possibility to start the local E-Mailprogramm with the Parameter: Email Adress, Subject and a file as a attachment.

In the same way as “mailto” by HTML.

Do you ask how to start the standard e-mail client out of your app?

I do this:


Thaks, its works.

Hi Michael, What to do with a attachment??

it works great! how to add CCO and attachment?

2 useful links…

Nothing with a attachement?

Search at the forum for ATTACHMENT. But with ShowURL you will not get an attachment into your standard e-mail client.

If you must do an e-mail with attachment you should use the SMTP Socket.

I have an app with this:

Public Sub SendEMailSecureSMTP(MS as SMTPSecureSocket, iv_Absender as string, iv_Subject as string, iv_BodyPlain as string, iv_BodyHTML as string, iv_Empfnger as string, iv_ServerAddress as string, iv_ServerPort as integer, iv_EMailBenutzer as string, iv_EMailPasswort as String, iv_HeaderValue as string)
  // --------------------------------------------------------------------------------------------
  // EMail-Versand aus dem eigenen Programm
  // --------------------------------------------------------------------------------------------
  // MS                 - SMTP Secure Socket 
  // iv_Absender        - Absender der E-Mail
  // iv_Subject         - Betreff der E-Mail
  // iv_BodyPlain       - Textkrper der E-Mail als einfacher Text
  // iv_BodyRTF         - Textkrper der E-Mail als enriched Text -> ConversionRTFtoEnrichedText
  // iv_Empfnger       - Empfnger der E-Mail
  // iv_ServerAddress   - Adresse des E-Mail-Servers fr ausgehende E-Mail
  // iv_ServerPort      - Port des E-Mail-Servers fr ausgehende E-Mail
  // iv_EMailBenutzer   - E-Mail-Benutzername beim E-Mail-Provider
  // iv_EMailPasswort   - E-Mail-Passwort beim E-Mail-Provider
  // --------------------------------------------------------------------------------------------
  dim Email as new EmailMessage
  email.FromAddress   = iv_Absender
  email.Subject       = iv_subject
  email.BodyPlainText = iv_BodyPlain
  'email.BodyEnriched  = iv_BodyRTF
  email.BodyHTML      = iv_BodyHTML
  MS.Address  = iv_ServerAddress
  MS.Port     = iv_ServerPort
  MS.Username = iv_EMailBenutzer
  MS.Password = Passwort(iv_EMailPasswort,false)
  MS.ConnectionType = SMTPSecureSocket.TLSv1
  MS.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
  MS.Secure   = true
End Sub

Where MS is my MailSocket of type SMTPSecureSocket.

And EMAIL of type EmailMessage can hold an attachment. Have a look to the language reference for EmailMessage and the property “attachments”.

You can send mails with attachments via AppleScripting Mail and Outlook. The other mail clients aren’t scriptable.

If you trust your users to enter the correct data for their Imap accounts then use the code above . And you don’t mind getting attachments with duplicate names. See feedback://showreport?report_id=42655.

If you send many (at least more than a couple) of mails use an email provider like SendGrid or MailChimp. There you can hardcode Imap server and password. Use Curl from the MBS plugin or the Chilkat plugin to avoid the bug with the duplicate attachment names.