Apache and Node run as two different servers and two different processes.
As described by others, you could use client-side ajax to trigger actions between the two servers. You could use something like dnode that provides RPC (remote procedure calls) between two servers. As described on https://github.com/substack/dnode There are dnode implementations for perl, ruby, php, and java, so you can glue together all your backend processes swimmingly.
On the same server you could create a new process. For instance, using PHP you could use system
or popen
to call node. ie. system("node mail.js [args]")
. Make sure to escape your arguments carefully. Here is a popen example: http://svn.php.net/viewvc/pear/packages/Mail/trunk/Mail/sendmail.php?view=markup
Note: I am not sure what advantages using node mail has over using the standard implementation in your apache stack (ie. using PHPjust call mail()
). If you are looking for non-blocking there are options available in most cases: Send mail without blocking 'execution'