Archivio mensile:marzo 2013

Using SSMTP Mail Client With PHP

After installing the SSMTP (Linux Mail Client)

Now We are going to use it with PHP, Just Create a file (mailTest.php)


Then ,



Finally , Test your PHP Script from the Command Line


Lascia un commento

Pubblicato da su marzo 27, 2013 in Linux


Linux SSMTP Mail Client Configuration


Add these lines to the ssmtp configuration file (ssmtp.conf)




2 commenti

Pubblicato da su marzo 26, 2013 in Uncategorized


Share your Programming Experience

An Invitation to all our followers.
Here you can share your programming experience with us.
So that we can help others to find solutions for their programming problems
you can post in whatever programming language you want.

Peter Eskandar


2 commenti

Pubblicato da su marzo 26, 2013 in Programming


Send Mail using PHP , EasyPHP and Gmail

To run this example you have to :

  • Install EasyPHP
  • Download PHPMailer
  • Put the PHPMailer folder inside the PHP installation folder, in my case C:\Program Files\EasyPHP12.1\php\
  • Modify Some parameters in PHP Configuration file (php.ini) 
    • insert this line include_path = “.;${path}\php\phpmailer”
    • set smtp_port = 465
    • SMTP =
    • and uncomment this line extension=php_openssl.dll

After tha Create email.php and put it in your WWW root folder

$mail = new PHPMailer();

//GMAIL config
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = “ssl”; // sets the prefix to the server
$mail->Host = “”; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = “put ur gmail account here”; // GMAIL username
$mail->Password = “ur email password”; // GMAIL password
//End Gmail

$mail->From = “ur gmail account again”;
$mail->FromName = “name”;
$mail->Subject = “some subject”;
$mail->MsgHTML(“the message”);

//$mail->AddReplyTo(“”,”reply name”);//they answer here, optional
$mail->AddAddress(“destination email address”,”name to”);
$mail->IsHTML(true); // send as HTML

if(!$mail->Send()) {//to see if we return a message or a value bolean
echo “Mailer Error: ” . $mail->ErrorInfo;
} else echo “<script>alert(‘Email sent’)</script>”;
// echo “Message sent!”

 Test the page using the following URL : http://localhost:8080/email.php
if you get this message, then you have successfully sent your email





Lascia un commento

Pubblicato da su marzo 26, 2013 in Programming


Tag: ,

Execute CMD Commands Using a Simple Java Interface



package cmd;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;


public class JavaRunCommand extends JFrame {

   private JTextField CMDField = new JTextField(40);
   private JButton ExecuteButton = new JButton(“Execute Command”);
   private JLabel CommandLabel = new JLabel(“Command: “);
   private JTextArea OutPut = new JTextArea(20, 30);
   private JScrollPane jsp = new JScrollPane(OutPut);

   public JavaRunCommand( ) {
   super(“CMD Simulator”);
   Container contentPane = this.getContentPane( );
   contentPane.setLayout(new BorderLayout( ));
   JPanel labels = new JPanel( );
   labels.setLayout(new GridLayout(4, 1));

  JPanel fields = new JPanel( );
  fields.setLayout(new GridLayout(4, 1));

  Box north = Box.createHorizontalBox( );
  contentPane.add(north, BorderLayout.NORTH);
  OutPut.setFont(new Font(“Monospaced”, Font.PLAIN, 12));
  contentPane.add(jsp, BorderLayout.CENTER);

  JPanel south = new JPanel( );
  south.setLayout(new FlowLayout(FlowLayout.CENTER));
  ExecuteButton.addActionListener(new ActionButton( ));
  contentPane.add(south, BorderLayout.SOUTH);

  class ActionButton implements ActionListener

  public void actionPerformed(ActionEvent arg0) {
  // TODO Auto-generated method stub
  String CMD = CMDField.getText() ;
  try {
  // Run “netsh” Windows command
  Process process = Runtime.getRuntime().exec(CMD);
  String temp = “”;

// Get input streams
  BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
  BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));

// Read command standard output
  String s;
  System.out.println(“Standard output: “);
  while ((s = stdInput.readLine()) != null) {
  temp +=s + “\n”;

// Read command errors
  System.out.println(“Standard error: “);
  while ((s = stdError.readLine()) != null) {
  temp +=s + “\n”;
} catch (Exception e) {



public static void main(String[] args) {
JavaRunCommand client = new JavaRunCommand();
// Next line requires Java 1.3 or later. I want to set up the
// exit behavior here rather than in the constructor since
// other programs that use this class may not want to exit
// the application when the SMTPClient window closes.
client.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); );

Lascia un commento

Pubblicato da su marzo 25, 2013 in Programming