How to send email within an NSIS installer? - email

Background:
For our software product (web application) clients will need to request a license from us before installing it.
We would need to check if they are a paying client (a manual process at the moment).
I need the ability for one of the initial steps of my installer to be let user request license via a custom page in the NSIS installer.
They would put in some mandatory fields and then this would get fired off in an email.
Ideally, NSIS would let them know that the email had successfully been sent.
They would then exit the wizard, but when we verify who they are and send them a serial (few days later), they can run installer again, and there would be an option to enter the serial, allowing them to progress to the next screen.
Ideally, the custom page will look something like this.
Question:
It is the emailing bit that I am currently stumped on.
I have not seen any plugins to do this.
How can I send an email from a custom page in NSIS?
- I imagine there might be a couple of approaches?

Probably best way to send emails is to use external application.
You can develop simple application in C/C++/C# if you have some programming skills, but there exist many apps for this purpose, e.g try this one called bmail:
http://www.beyondlogic.org/solutions/cmdlinemail/cmdlinemail.htm
C:\>mail -s smtp.server -t cpeacock#max -f root#neptune -h -a "Subject e.g. Fatal Error"
-b "Body of message e.g. Fatal Error occurred in cgi script, secure.cgi"
Simply use nsExec plugin to call this .exe with your desired parameters.
Alternatively create.bat file with appropriate parameters, unpack it to $PLUGINS directory together with bmail.exe and launch the .bat using ExecWait command from NSIS.
For creating custom page try this tool for NSIS: http://www.graphical-installer.com - it allows you to create skinned installer with custom page you need.

Related

Automation using powershell

I want to create a script that will launch an application and configure it completely with provided input values.
ex: Launch outlook-> enter default address-> choose connect ->proceed with next options and finish
How can this be achieved using powershell script?
I am able to launch the applications but not sure how to input values to it.
Ths is a very broad topic, and the answer will depend on the specifics of any given application.
Here is a technet article that dscusses various ways to launch an application, with the benefits and drawbacks of each: https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx
There are sevaral approaches depending on the app & installer but the basic key is that you must be able to configure the app manually using nothing but command line tools.
If you can do it manually, e.g., one command at a time then scripting the full install becomes easy.
Most/many installers have switches for "silent install" though Outlook is a complicated setup, start there.
Many installers will show there options when you type: InstallerName /?
Usually the options you need are /silent or /q or /quiet and perhaps.
Office has the concept of creating .MST files (t=transform) to provide additional configuration so search for "creating an officer transform" file.
For some apps, you can monitor the registry with a "registry watcher" app and then write a script to make the same/similar settings for each install.
With Outlook, I would first pursue the MST/transform route and ask this question in places where Office and Outlook are discussed.

FileMaker Task Automation

I'd like to automate several FileMaker tasks using Windows Task Scheduler. It looks like step scripts are the way to go, but I'm not sure. I'd like to run tasks, say exporting for example, several times per day, but WITHOUT opening the FileMaker GUI. Is that possible? Any tips you have would be great. Thanks.
It's possible to initiate a Filemaker script using a schedule server script with Filemaker Server. However, if the database is not hosted using Filemaker server, or not open using Filemaker Pro (sounds like your situation), then there is no active engine able to actually perform the calculations (script steps, etc). The database has to be running somewhere to initiate and perform any scripts.
If the database is hosted using Filemaker Server then it is pretty easy to setup a scheduled script that will run at a designated time. If you don't have a license of Filemaker Server some Filemaker cloud hosting providers have monthly plans that are relatively cheap ($20/month with unlimited connections), and they'll work with you to setup a scheduled script (for free).
The best way to automate FileMaker tasks is to use FileMaker Server which has scheduled scripts. Of course it is more expensive than standalone version of FileMaker Pro.
If you automate tasks on a local FileMaker file, you can not avoid starting FileMaker and opening the file.
FileMaker has a limited support for VBScript, you can run FileMaker, open file and run a FileMaker Script from VBScript and add that script to Windows Task Scheduler.
This is not preferable way, but if you have no other option, this may be handy.
in Task Scheduler, Create a task
on Action tab, choose
"Start Program"
on the next screen, point to FileMaker Pro exe file, typically it is in C:\Program Files\Filemaker Pro\FileMaker.exe
Add argument:
"fmp://hostName/fileName.fmp12?script=scriptName&param=optionalScriptParameters"
please read more here http://www.filemaker.com/help/12/fmp/en/html/sharing_data.16.7.html about url schema. This will vary depending on whether you are hosting your file on FileMaker Server or opening it locally.
Note: avoid having spaces or special characters in script name.
Save the task. Reopen task properties and save your windows account credentials, so that the task may run without you having to login.
either save FileMaker login credentials upon login (if your FM version allows), or pass credentials through fmp url (as described in the link above), or go to FileMaker file options, and use credentials in "Log in using": (which is not secure and not recommended).
I am using this method to automatically send emails with PDF attachments, since FileMaker server does not let you Export Records as PDF (not until v.16) on server scripts.

PHP mail() in dev environment: open the mail in a browser/editor instead of sending it?

On my machine I need to test the mails sent by my application. I'd rather avoid sending real mails.
Is there a way to have the email content showed to the screen a way or another, maybe by opening it in gedit or any text editor?
Maybe like replacing the commandline used to launch "sendmail"?
I am asking for Linux machines (Ubuntu more specifically).
Include a means of determining your environment in your project, or at least some kind of global variable that holds that information.
Then build an abstract mail interface that either sends real mails if it's running on a production server, but logs them to local files in case it runs on a dev machine / environment. As a logging package, I would recommend Monolog.
This would allow you to design the rest of your application (or at least the mail sending components) in a way that doesn't have to care about the environment.
After searching, here is the solution I came to:
create a script that will fake a smtp server
/usr/local/bin/sendmail-fake:
#!/bin/bash
{
date
echo $#
cat
} >> /var/log/sendmail-fake.log
configure PHP:
php.ini:
sendmail_path = /usr/local/bin/sendmail-fake
In this setup, emails are logged into a file. The script could be modified to open the content into a browser.
More details on the blog post.

How can I download a perl script from a CGI server instead of running it?

I am trying to download the perl scripts from this site:
http://pages.cs.wisc.edu/~david/courses/cs552/S12/handouts/bins/
When I open or download any of them, the scripts execute. However, I want the text in the scripts. Is there any way I can do this?
For the non .pl files,
The server is actually retuning the script (not its output), so you must be executing it on your end. Right-click on the link and choose Save Link As.
For the .pl files,
The server is actually executing these scripts and returning the output. You would need to use a different URL to get the script itself. No such URL is likely to exist.
Contact your prof and advise him of the issue.
If the scripts are executing then the webserver is configured to execute scripts in that directory or it is configured to execute all .pl or .cgi files where ever they reside. That is normal for a webserver to execute a script. If you want the script source then the webserver must be configured to not execute the scripts, in which case it would deliver the source you are after. Contact the administrator to configure correctly, assuming they shouldn't be executing.
Otherwise you would need filesystem access to ~david/courses/cs552/S12/handouts/bins/, be it via FTP or whatever to download them. Basically access however you can without it being over HTTP.
Just right-click it and choose "Save link As..." (works only if no script processing enabled on server side)
Normaly you can't do this, because when you request any script it beiing processed server-side and only result shown at browser.
If you try to configure you httpd to let users download scripts you should disable script handling by extension, or just change the extension to txt for example.

Can Selenium IDE deal effectively with Browser alerts

Hi I am currently writing a Test script for an ecommerce site using Seleneium IDE, this is in a testing environment in HTTP. The issue I am having is the test payment gateway 3D Secure is in HTTPS so when using FireFox the browser displays the security warning message when I am returning from the payment gateway 3D Secure HTTPS to the site testing environment.
'Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection and could easily be read by a third party.
Are you sure you want to continue sending this information?'
I have tried the various commands in the IDE for waitForAlert* and asertAlert* but this javascript alert just seems to over ride any of the commands I use and essentially halts the script until manual intervention is used.
I am unable to turn this particular alert off in FF from what I can assertain from various forums as it is too important to be switched off, I have tried in FF about:config
I can obviusly switch the 3D secure off to allow thee script to run, but I would prefer a complete user scenario to be tested as opposed to a test adapted to suit automation.
Many thanks in advance for your time and assistance.
I had exactly the same problem :
I use Selenium web driver to test against my local http server which sends redirects to https service (3DS as well btw ;). The problem is not with certs, but with this hardcoded warning of switching between https/http.
Based on the link from MacGyver's answer and this answer Key press in (Ctrl+A) Selenium WebDriver, I tested this and I can confirm it closes "Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection and could easily be read by a third party" dialog:
Alert alert = driver.switchTo().alert();
alert.accept();
The other solution, seems to work fine but you'll get UnhandledAlertException with latest Selenium versions (e.g. 2.25.0) :
Actions a = new Actions(driver);
a.sendKeys(Keys.ENTER).perform();
Option #1:
The easiest way is to remove the option in security options for your profile:
http://forums.mozillazine.org/viewtopic.php?f=38&t=665552
Option #2:
Not sure if this applies to an untrusted certifiate or your security warning, but the forum thread seemed to fit. It requires that you use Selenium RC Server.
Profiles are stored here for Firefox: %APPDATA%\Mozilla\Firefox
Profiles can be edited: http://www.dennisplucinik.com/blog/2011/02/04/how-to-install-run-multiple-firefox-versions-in-windows-simultaneously/
Follow the snippet below from this link:
http://old.nabble.com/Security-Warning-on-final-page,-how-to-remove-td22907376.html
If using Firefox 3, see the following post https://developer.mozilla.org/En/Cert_override.txt
The solution I use to get past this security pop-up is only applicable to Firefox 3 browsers and might be more of an hack than a fix but it works.
Run the selenium test
Select "Accept this certificate permanently" when prompted by popup
Click on the OK button (it might be neccessary to have a pause after this because we need to open explorer to find a file now)
Open Windows Explorer and navigate to => "C:\Users\xxxxxxxx\AppData\Local\Temp\customProfileDirxxxx"
This is a temparary profile created by Firefox which contains a file called "cert_override.txt"
Copy "cert_override.txt" to your temp directory
Stop your selenium server.
Open your "selenium-server.jar" file from "c:\selenium-remote-control-xxx\selenium-server-xxx" using WinRar
Drag "cert_override.txt" file into the "selenium-server.jar\customProfileDirCUSTFFCHROME" folder in WinRar (do not delete or edit anything in the .jar file!!!!!)
Close WinRar, start selenium and try it again :)