Page 1 of 1

HOWTO: send email without opening empty browser page

PostPosted: Tue Jan 17, 2006 11:55 am
by Harjo
Hi,

I think I have a great tip for you all.
When you use this code in a Servoy Client on Windows:

Code: Select all
application.showURL('mailto:info@servoy.com')


There was always opening that annoying empty browser-page!

I found a away to workaround this one:

make a global method and call it: mailto

Code: Select all
var email = 'mailto:'
email += arguments[0]
if(utils.stringMiddle(application.getOSName(),1,7) == "Windows")
{
   application.executeProgram('rundll32', 'url.dll,FileProtocolHandler',email)
}
else application.showURL(email)


Now call the global method with:
Code: Select all
globals.mailto('info@servoy.com')


The emailclient will open without the empty browser-page!
Have FUN!

PostPosted: Thu Jan 19, 2006 5:50 pm
by edward
Great Tip Harjo!!

Thanks very much!

PostPosted: Fri Aug 18, 2006 7:43 pm
by rarbuthnot
Occasionally, when users try to send email from Windows machines, their default email client does not open.

The only thing that I can think is that something (e.g. a special character) in my email_string is causing windows to not open the default email client.

No errors are shown to the user. Nothing is logged on the server. When the debugger is turned on, it never complains, etc.

PostPosted: Fri Aug 18, 2006 9:18 pm
by rarbuthnot
The problem seems to be that if the email_string is longer than 2037 characters, windows ignores the command.

This is on a Windows XP Service Pack 2.

Any ideas around this?

Thanks.

PostPosted: Tue Oct 17, 2006 11:21 pm
by Providence1
On your PC, goto My Computer, the Tools drop down, Folder Options, File Types tab, scroll down to htm and html. Do the File Types say URL:HyperText Transfer Protocol and HTML File or Internet Explorer or something else like FireFox?

If URL:HyperText Transfer Protocol doesn't work, then try IE or even setting it to Outlook.

Worked for me.

Re: HOWTO: send email without opening empty browser page

PostPosted: Mon Jul 16, 2012 11:00 am
by huber
Hi Harjo

Thanks for this tip! Have you got any idea how to avoid opening the default mail client on OS X without getting a browser window?

Regards, Robert

Re: HOWTO: send email without opening empty browser page

PostPosted: Mon Mar 16, 2015 7:17 pm
by tgs
Hello!

Harjo's tip to send an e-mail from Seervoy Smart Client with Mail by application.showURL(params) without opening a empty browser page unfortunately don't work currently on Mac OS X (10.9, 10.10).

Is there a way to get this working only by opening the Mail form?

It would also be great to be able to attach PDF's to the Mail send form.
Does anybody knows a solution to do that by the standard e-mail programs on Mac AND Windows?

Regards

Re: HOWTO: send email without opening empty browser page

PostPosted: Mon Mar 16, 2015 7:58 pm
by mboegem
Hi Thomas,

Back in 2006 OS might have reacted a little bit different.
Why don't you create a form to build the email message, including pdf (file plugin with type filtering)
On submit you can send out the message using the mail plugin.

This solution works exactly the same for Mac/Windows and you're even more flexible pre-populating addressees, subject, body
Using the 'mailto' tip might restrict you to a number of characters.

Re: HOWTO: send email without opening empty browser page

PostPosted: Mon Mar 16, 2015 8:30 pm
by tgs
Hi Marc,

you are right, but customers would like to send their e-mails by the Mail program.
Of course I can always send a second e-mail to a seperate account to have organized all e-mails in the Mail program.
But it is more complex to make a solution for creating an e-mail with content incl. a PDF, to display it as preview and to execute sending like an e-mail program.

Regards

Re: HOWTO: send email without opening empty browser page

PostPosted: Tue Mar 17, 2015 12:18 am
by sbutler
I think you could use AppleScript for this. Servoy can execute applescript (search the forum, several topics on that). I'm sure you can find many examples of sending email via AppleScript. So just tie those two together, and it should have what you need.

Re: HOWTO: send email without opening empty browser page

PostPosted: Tue Mar 17, 2015 12:58 am
by tgs
Thank you Scott,
I will give it a try.
I also will create a support ticket as feature request. Perhaps the Servoy guys take a look on it for an implementation.

Regards

Re: HOWTO: send email without opening empty browser page

PostPosted: Tue Mar 17, 2015 10:14 am
by mboegem
tgs wrote:Of course I can always send a second e-mail to a seperate account to have organized all e-mails in the Mail program.


If your customers can work with IMAP of Exchange you can use the mailpro plugin / exchange plugin to achieve exactly that.

Re: HOWTO: send email without opening empty browser page

PostPosted: Thu Mar 19, 2015 11:21 am
by omar
To get rid of the deprecation warning but the second and third parameter in an array:

Code: Select all
application.executeProgram('rundll32', ['url.dll,FileProtocolHandler', email])

Re: HOWTO: send email without opening empty browser page

PostPosted: Sun Mar 22, 2015 1:44 pm
by tgs
omar wrote:To get rid of the deprecation warning but the second and third parameter in an array:

Code: Select all
application.executeProgram('rundll32', ['url.dll,FileProtocolHandler', email])


That's right, but 'MaiToProtocolHandler' I think.