2017-03-27 97 views
-1

我想在linux(僅客戶端)中開發STMP/POP3客戶端。我想使用數字證書來加密數據(我會嘗試提供端到端的安全性)。我也想創建一個簡單的界面(帶有文本框,發送按鈕,收件箱等)。我的問題是:我應該在java(如果可能的話)或C/C++(在這種情況下,我必須使用一些工具,例如接口 - > QT)這樣做。你怎麼看? 第二個問題:如果您有任何想法/建議或有用的鏈接(或任何可以幫助我的),我將不勝感激。Linux中的SMTP/POP3客戶端

回答

1

關於你的第一個問題

我應該這樣做在Java中(如果可能的話)或C/C++

您可以使用您感到舒適與任何語言,如果你想要我建議我建議你使用java,因爲使用Swing或Javafx創建圖形界面非常簡單,並且有很多庫可以幫助實現你的目標。

而關於你的第二個問題

,如果您有任何意見/建議或有用的鏈接

你可以找到一個有用的教程,指導您從一開始就告訴本網站到底:JavaMail API Tutorial - Tutorialspoint

這裏是一個簡單的應用程序接口以您的項目開始使用JavaFx創建。

Simple Application UI Using JavaFX Desktop Screen-shot

Main.java

package application; 

import javafx.application.Application; 
import javafx.stage.Stage; 
import javafx.scene.Scene; 
import javafx.scene.layout.AnchorPane; 
import javafx.fxml.FXMLLoader; 


public class Main extends Application { 
    @Override 
    public void start(Stage primaryStage) { 
     try { 
      AnchorPane root = (AnchorPane)FXMLLoader.load(getClass().getResource("Email.fxml")); 
      Scene scene = new Scene(root,400,400); 
      scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 
      primaryStage.setScene(scene); 
      primaryStage.show(); 
     } catch(Exception e) { 
      e.printStackTrace(); 
     } 
    } 

    public static void main(String[] args) { 
     launch(args); 
    } 
} 

EmailController.java

package application; 

import java.net.URL; 
import java.util.ResourceBundle; 
import javafx.fxml.FXML; 
import javafx.scene.control.Button; 
import javafx.scene.control.PasswordField; 
import javafx.scene.control.TextArea; 
import javafx.scene.control.TextField; 

public class EmailController { 

    @FXML 
    private ResourceBundle resources; 

    @FXML 
    private URL location; 

    @FXML 
    private TextField fromField; 

    @FXML 
    private TextField toField; 

    @FXML 
    private TextField loginField; 

    @FXML 
    private PasswordField passwordField; 

    @FXML 
    private TextField subjectField; 

    @FXML 
    private TextArea messageField; 

    @FXML 
    private Button deleteButton; 

    @FXML 
    private Button sendButton; 

    @FXML 
    void initialize() { 


    } 
} 

Email.fxml

<?xml version="1.0" encoding="UTF-8"?> 

<?import javafx.geometry.Insets?> 
<?import javafx.scene.control.Button?> 
<?import javafx.scene.control.Label?> 
<?import javafx.scene.control.PasswordField?> 
<?import javafx.scene.control.TextArea?> 
<?import javafx.scene.control.TextField?> 
<?import javafx.scene.layout.AnchorPane?> 
<?import javafx.scene.layout.ColumnConstraints?> 
<?import javafx.scene.layout.GridPane?> 
<?import javafx.scene.layout.Pane?> 
<?import javafx.scene.layout.RowConstraints?> 
<?import javafx.scene.layout.VBox?> 
<?import javafx.scene.text.Font?> 


<fx:root type="AnchorPane" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.111" fx:controller="application.EmailController"> 
    <children> 
     <Pane prefHeight="522.0" prefWidth="761.0"> 
     <children> 
      <VBox prefHeight="522.0" prefWidth="761.0"> 
       <children> 
        <GridPane gridLinesVisible="true"> 
        <columnConstraints> 
         <ColumnConstraints hgrow="SOMETIMES" maxWidth="328.0" minWidth="10.0" prefWidth="131.0" /> 
         <ColumnConstraints hgrow="SOMETIMES" maxWidth="635.0" minWidth="10.0" prefWidth="630.0" /> 
        </columnConstraints> 
        <rowConstraints> 
         <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
         <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
         <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
         <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
        </rowConstraints> 
        <children> 
         <Label alignment="CENTER_RIGHT" prefHeight="23.0" prefWidth="136.0" text="From : "> 
          <font> 
           <Font name="Segoe UI" size="18.0" /> 
          </font> 
         </Label> 
         <TextField fx:id="fromField" GridPane.columnIndex="1" /> 
         <Label alignment="CENTER_RIGHT" prefHeight="17.0" prefWidth="134.0" text="To : " textAlignment="CENTER" GridPane.rowIndex="1"> 
          <font> 
           <Font name="Segoe UI" size="18.0" /> 
          </font> 
         </Label> 
         <Label alignment="CENTER_RIGHT" prefHeight="17.0" prefWidth="134.0" text="Login : " textAlignment="CENTER" GridPane.rowIndex="2"> 
          <font> 
           <Font name="Segoe UI" size="18.0" /> 
          </font> 
         </Label> 
         <TextField fx:id="toField" GridPane.columnIndex="1" GridPane.rowIndex="1" /> 
         <TextField fx:id="loginField" GridPane.columnIndex="1" GridPane.rowIndex="2" /> 
         <Label alignment="CENTER_RIGHT" prefHeight="17.0" prefWidth="134.0" text="Password : " textAlignment="CENTER" GridPane.rowIndex="3"> 
          <font> 
           <Font name="Segoe UI" size="18.0" /> 
          </font> 
         </Label> 
         <PasswordField fx:id="passwordField" GridPane.columnIndex="1" GridPane.rowIndex="3" /> 
        </children> 
        </GridPane> 
        <GridPane prefHeight="240.0" prefWidth="681.0"> 
        <columnConstraints> 
         <ColumnConstraints hgrow="SOMETIMES" maxWidth="659.0" minWidth="10.0" prefWidth="152.0" /> 
         <ColumnConstraints hgrow="SOMETIMES" maxWidth="722.0" minWidth="10.0" prefWidth="609.0" /> 
        </columnConstraints> 
        <rowConstraints> 
         <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
         <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
         <RowConstraints /> 
         <RowConstraints minHeight="10.0" prefHeight="30.0" /> 
        </rowConstraints> 
        <children> 
         <Label alignment="CENTER_RIGHT" prefHeight="23.0" prefWidth="150.0" text="Subject : "> 
          <font> 
           <Font name="Segoe UI" size="18.0" /> 
          </font> 
         </Label> 
         <TextField fx:id="subjectField" GridPane.columnIndex="1" /> 
         <Label alignment="CENTER_RIGHT" prefHeight="23.0" prefWidth="150.0" text="Message : " GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.vgrow="ALWAYS"> 
          <font> 
           <Font name="Segoe UI" size="18.0" /> 
          </font> 
         </Label> 
         <TextArea fx:id="messageField" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.rowSpan="2"> 
          <GridPane.margin> 
           <Insets top="10.0" /> 
          </GridPane.margin> 
         </TextArea> 
        </children> 
        <VBox.margin> 
         <Insets left="30.0" right="30.0" top="20.0" /> 
        </VBox.margin> 
        </GridPane> 
        <Pane prefHeight="200.0" prefWidth="200.0"> 
        <children> 
         <Button fx:id="deleteButton" layoutX="220.0" layoutY="30.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="150.0" text="Delete"> 
          <font> 
           <Font name="Segoe UI" size="24.0" /> 
          </font> 
         </Button> 
         <Button fx:id="sendButton" layoutX="450.0" layoutY="30.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="150.0" text="SEND"> 
          <font> 
           <Font name="Segoe UI" size="24.0" /> 
          </font> 
         </Button> 
        </children> 
        </Pane> 
       </children> 
      </VBox> 
     </children> 
     </Pane> 
    </children> 
</fx:root> 
+0

謝謝您的意見! –