- NSIS Discussion
- Sending email
Archive: Sending email
rikkov
28th April 2009 07:29 UTC
Sending email
Hi,
I am very new to nsis scripting.I need some example script on how I can send emails when my application is being installed in a PC.
Like when the user installs my application with the correct serial key...the installer sends me a nofication to my email that an installer with serial key XXXXX has been installed.
Thanks
Rikkov
Afrow UK
28th April 2009 12:07 UTC
This isn't possible without the user giving you their e-mail address and you knowing their POP3/SMTP servers. If you do have that information there's probably some command-line executable you can use if you search on Google.
The other option is to have a PHP script on a web server which you query using the inetc plugin. You can send e-mails via the PHP script.
Stu
Anders
28th April 2009 12:08 UTC
What if the user does not have a mail account set up? You should probably post the data to your webserver. Remember that email is not encrypted, with HTTP you at least have the option of using SSL
edit: Afrow UK is faster on the trigger :D My point about encryption is still valid tho
rikkov
28th April 2009 18:30 UTC
Thanks a lot for the fast reply..
How can I implement my requirement through PHP scripts?
It would be really great if you guys could point me out to an example that's doing something similar(I hope I am not asking for a lot) :)
I don't have any experience with PHP.
Thanks
rikkov
Afrow UK
28th April 2009 20:16 UTC
First hit when search for 'php email' on Google:
http://email.about.com/cs/phpemailtips/qt/et031202.htm
Stu
rikkov
29th April 2009 09:31 UTC
Thanks a lot for the link....
SInce I have no experiance with PHP...Can you please give me a small introduction...How should I implement my requirement...What are the requirements at the installer end and server end?
A small example with nsis script and its corresponding php script would really help...
Thanks
rikkov
sgiusto
29th April 2009 09:45 UTC
Another solution may be to upload via FTP some file with the required information.
Putting online a FTP server (like filezilla) is easy and do not require to write code.
Stefano
Afrow UK
29th April 2009 11:25 UTC
Uploading via FTP is a bit pointless IMO as you need to have the logon username and password in the script as well as the FTP address - all of which could be extracted for malicious purposes. It would be better and more secure to upload using a PHP script via a HTTP POST.
rikkov, that link I posted has an example PHP script on it! You just need to send it a HTTP POST request via the inetc plugin (read the doc). In PHP, POST fields can be read via the $_POST global hash table - i.e. $_POST['FieldName'] will contain "text" if the PHP script is sent FieldName=Text.
Stu
sgiusto
29th April 2009 15:52 UTC
I know we are going off topic.... :D
you can configure your ftp server so that a user can only 'put' files and never read or list files from it (a drop box)
It is the same that making an http post
Both can be extracted and used with the only purpose of uploading massive quantity of garbage...
Said so I think the easiest way is the one that is better known (I am able to start an ftp server from scratch in minutes and have no idea how to generate a .php page. :) )
Stefano
Afrow UK
29th April 2009 16:41 UTC
I wasn't aware of that but this is a PHP script which can be used for uploading data to a file:
<?php
if (isset($_POST['data']))
{
header('Content-type: text/plain');
$fp = fopen($_POST['file'], w);
if ($fp)
{
if (fwrite($fp, $_POST['data']))
echo 'OK';
fclose($fp);
}
}
?>
Would simply need to post file=filename.txt&data=text
Stu
rikkov
1st May 2009 10:38 UTC
Thanks a lot!!
Thanks a lot guys for the reply and fast help....things are working for me now..... :)