August 22, 2019, 11:50:24 am

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Email and Facebook

Started by Andy, July 09, 2018, 01:26:58 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

billhsln

See: http://www.ionicwind.com/forums/index.php?topic=4663.msg37253#msg37253

I would use the last suggestion.

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

Bill
When all else fails, get a bigger hammer.

fasecero

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.

Andy

Thanks guys, but I don't have a default email program.

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

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy


Okay, this works:

Code Select
$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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

fasecero

July 10, 2018, 07:20:53 am #5 Last Edit: July 10, 2018, 09:17:14 am by fasecero
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

Andy

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.


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

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

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.