HOWTO: send email without opening empty browser page

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

HOWTO: send email without opening empty browser page

Postby Harjo » Tue Jan 17, 2006 11:55 am

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!
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby edward » Thu Jan 19, 2006 5:50 pm

Great Tip Harjo!!

Thanks very much!
Edward Callaghan
Servoy
edward
 
Posts: 142
Joined: Wed Apr 23, 2003 9:35 pm
Location: London, UK

Postby rarbuthnot » Fri Aug 18, 2006 7:43 pm

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.
Attachments
mailto-output.txt
the output string
(5.33 KiB) Downloaded 562 times
mailto.txt
the method
(1.56 KiB) Downloaded 547 times
rarbuthnot
 
Posts: 77
Joined: Tue May 02, 2006 8:18 pm
Location: chicago

Postby rarbuthnot » Fri Aug 18, 2006 9:18 pm

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.
rarbuthnot
 
Posts: 77
Joined: Tue May 02, 2006 8:18 pm
Location: chicago

Postby Providence1 » Tue Oct 17, 2006 11:21 pm

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.
Providence
Providence1
 
Posts: 456
Joined: Tue Aug 17, 2004 2:36 am
Location: New York, NY

Re: HOWTO: send email without opening empty browser page

Postby huber » Mon Jul 16, 2012 11:00 am

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
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 516
Joined: Mon May 14, 2012 11:31 pm

Re: HOWTO: send email without opening empty browser page

Postby tgs » Mon Mar 16, 2015 7:17 pm

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
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Re: HOWTO: send email without opening empty browser page

Postby mboegem » Mon Mar 16, 2015 7:58 pm

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.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: HOWTO: send email without opening empty browser page

Postby tgs » Mon Mar 16, 2015 8:30 pm

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
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Re: HOWTO: send email without opening empty browser page

Postby sbutler » Tue Mar 17, 2015 12:18 am

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.
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: HOWTO: send email without opening empty browser page

Postby tgs » Tue Mar 17, 2015 12:58 am

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
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Re: HOWTO: send email without opening empty browser page

Postby mboegem » Tue Mar 17, 2015 10:14 am

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.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: HOWTO: send email without opening empty browser page

Postby omar » Thu Mar 19, 2015 11:21 am

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])
Intrasoft, Founder
Omar van Galen
omar@intrasoft.nl
+31-(0)6-21234586
Servoy Developer
omar
 
Posts: 377
Joined: Sat Feb 12, 2011 4:51 pm
Location: Intrasoft, The Netherlands

Re: HOWTO: send email without opening empty browser page

Postby tgs » Sun Mar 22, 2015 1:44 pm

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.
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany


Return to How To

Who is online

Users browsing this forum: No registered users and 6 guests