2
0
Эх сурвалжийг харах

Add port optional parameter

Pascal Peridont 19 жил өмнө
parent
commit
33dbbd7014

+ 5 - 3
std/mtwin/mail/Smtp.hx

@@ -5,13 +5,15 @@ import mtwin.mail.Exception;
 
 class Smtp {
 
-	public static function send( host : String, from : String, to : String, data : String ){
+	public static function send( host : String, from : String, to : String, data : String, ?port: Int ){
+		if( port == null ) port = 25;
+
 		var cnx = new Socket();
 		
 		try {
-			cnx.connect(Socket.resolve(host),25);
+			cnx.connect(Socket.resolve(host),port);
 		}catch( e : Dynamic ){
-			throw ConnectionError(hort,25);
+			throw ConnectionError(host,port);
 		}
 		
 		// get server init line