Browse Source

Add port optional parameter

Pascal Peridont 19 years ago
parent
commit
33dbbd7014
1 changed files with 5 additions and 3 deletions
  1. 5 3
      std/mtwin/mail/Smtp.hx

+ 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