IonicWind Software

IWBasic => General Questions => Topic started by: Andy on July 09, 2018, 01:26:58 AM

Title: Email and Facebook
Post by: Andy on July 09, 2018, 01:26:58 AM
Okay,

I have two problems to solve which involves emailing and Facebook message.

Email:

Do you need an email application installed on your machine before you can email someone with the examples here on this forum?
I tried them with the "mailto" but nothing happened.

I think most people use web mail now, as I do, so I experimented with my Yahoo web mail and found this:

If I go to my "Compose" page (for a new email) and copy the web link, I can use the SYSTEM "bla bla bla" command to open a new email page in Yahoo (where "bla bla bla" is the link to my compose page).

On the program I'm working on now I will have an email button and a field next to it where the email address is stored.

So when this button is clicked, I could copy the email address to the clipboard, use SYSTM "bla bla bla" to pull up Yahoo, and finally copy the email address in for the recipient.

That will work, or am I making it hard work?

Facebook:
Has anyone tried sending a message to a Facebook user programatically? (sorry useless at spelling).
I presume you would need to be logged in to FB to do it?

Thanks,
Andy.
Title: Re: Email and Facebook
Post by: billhsln on July 09, 2018, 09:36:22 AM
See: http://www.ionicwind.com/forums/index.php?topic=4663.msg37253#msg37253

I would use the last suggestion.

ShellExecuteA(0,"open","mailto:" + sEmailAddress, 0, 0, 1)

Bill
Title: Re: Email and Facebook
Post by: fasecero on July 09, 2018, 01:15:31 PM
In theory (we already know how unpredictable Windows can be) MailTo is a command that receives the default browser declared in default app settings. Chrome, for example, can ignore this command according to an user-defined variable. On the other hand, ShellExecute + "Open" is a command that goes directly to the OS Shell and it should (!) always work... Just in case, remember that it is a COM function and you need to call CoInitialize/CoUninitialize.
Title: Re: Email and Facebook
Post by: Andy on July 09, 2018, 10:57:40 PM
Thanks guys, but I don't have a default email program.

So what do I do, or am I missing the obvious?  ???

Andy.
Title: Re: Email and Facebook
Post by: Andy on July 10, 2018, 06:56:26 AM

Okay, this works:

$include "windowssdk.inc"
$include "commctrl.inc"

CoInitialize(NULL)
ShellExecuteA(0,"open","mailto:" + "sss@sss.com" + "?subject=Hi", 0, 0, 1)
CoUninitialize()


But you still need an email client on your machine.

Andy.
Title: Re: Email and Facebook
Post by: fasecero on July 10, 2018, 07:20:53 AM
I think that if you or one of your customers does not have a default email application there is not much that can be done. Maybe you can check the return value from ShellExecute.

Far from ideal, but you can check the browser that comes in the sample codes. Edit the address to something like ATTACHBROWSER(wb, "mailto: Name@Example.com") and see what happens. If it works, you could create a hidden browser for this purpose.

Edit. Here's some additional info about this
https://stackoverflow.com/questions/27176849/what-does-mailto-do-when-there-is-no-email-client (https://stackoverflow.com/questions/27176849/what-does-mailto-do-when-there-is-no-email-client)
Title: Re: Email and Facebook
Post by: Andy on July 15, 2018, 04:45:21 AM
Thanks every one!

So any thoughts on Facebook? and how to send a message / email to a FB user?

Anyone?

I don't do FB.

Thanks,
Andy.


Title: Re: Email and Facebook
Post by: Brian on July 15, 2018, 06:45:50 AM
Andy, I found this:

Determine the contact's Facebook address. You can check if the contact has sent you the address to use. Otherwise, you can navigate to the user's Facebook timeline and locate their public username at the end of their URL. For example, for the URL "http://facebook.com/user" the public username would be "user." This public username is the first part of the Facebook email address, so the email address would be "user@facebook.com."

Brian
Title: Re: Email and Facebook
Post by: Andy on July 16, 2018, 06:16:56 AM
Brian,

Thanks for that, I took a little while to read up on what you've mentioned, and I think that is the way to do it, i.e. send a message via email.

Thanks,
Andy.