CURL.SetOptionPort
------------------

Sets the port number for the connection.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionPort"; curl; Value ) 

**MBS**( **"CURL.SetOptionPort";** /\* Sets the port number for the connection. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* The new port number.e.g. 8000 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | The new port number. | 8000 |

### Result

Returns "OK" on success.

### Description

Sets the port number for the connection.  
Specify what remote port number to connect to, instead of the one specified in the URL or the default port for the used protocol.  
See also [CURL.SetOptionFTPPort](CURLSetOptionFTPPort.md).  
  
| Protocols | Common Ports |
|---|---|
| http | 80, 443 with SSL |
| ftp | connect with 21 and later uses 20 for data transfer. |
| sftp | 22 |
| smtp | 25, 465 with SSL, 587 |
| pop3 | 110, 995 with SSL |
| imap | 143, 993 with TLS |

See also [PORT](https://curl.haxx.se/libcurl/c/CURLOPT_PORT.html) option in CURL manual.

### Examples

Use Port 25 for smtp:

 MBS ( "CURL.SetOptionPort"; $curl ; 25 )  
\# alternative 587 or with SSL 465.   
Use Port 8080 for http:

 MBS ( "CURL.SetOptionPort"; $curl ; 8080 )  
Setup for IMAP with Google GMail:

 Set Variable \[ $curl ; Value: MBS ("[CURL.New](CURLNew.md)") \]   
Set Variable \[ $r ; Value: MBS ("CURL.SetOptionPort"; $curl ; 993) // IMAP SSL port \]   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionUseSSL](CURLSetOptionUseSSL.md)"; $curl ; 3) // require SSL \]  
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionSSLVersion](CURLSetOptionSSLVersion.md)"; $curl ; 6) // TLSv1.2 \]   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "imaps://imap.gmail.com/INBOX") \]   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionUserName](CURLSetOptionUserName.md)"; $curl ; $user ) \]   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionPassword](CURLSetOptionPassword.md)"; $curl ; $pass ) \]  
Set to use SMTP via SSL:

 Set Variable \[ $r ; Value: MBS ("CURL.SetOptionPort"; $curl ; 465) // SMTP SSL port \]   
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionUseSSL](CURLSetOptionUseSSL.md)"; $curl ; 3) // require SSL \]  
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionSSLVersion](CURLSetOptionSSLVersion.md)"; $curl ; 6) // TLSv1.2 \]  
Set Variable \[ $r ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "smtps://server.com") \]  
### See also

- [CURL.SetOptionGet](CURLSetOptionGet.md)
- [CURL.SetOptionPost](CURLSetOptionPost.md)
- [CURL.SetOptionProxy](CURLSetOptionProxy.md)
- [CURL.SetOptionQuote](CURLSetOptionQuote.md)
- [CURL.SetOptionRange](CURLSetOptionRange.md)
- [CURL.SetOptionSSLCert](CURLSetOptionSSLCert.md)
- [CURL.SetOptionURL](CURLSetOptionURL.md)
- [CURL.SetOptionUserName](CURLSetOptionUserName.md)
- [CURL.SetOptionUseSSL](CURLSetOptionUseSSL.md)
- [SendMail.SetSMTPServer](SendMailSetSMTPServer.md)

### Example Databases

- [CURL/Email/Batch Emailer](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Batch%20Emailer.shtml#1ScriptAnchor_)
- [CURL/Email/Build and send Email](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Build%20and%20send%20Email.shtml#1ScriptAnchor_)
- [CURL/Email/Build and send HTML Email with inline graphics](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Build%20and%20send%20HTML%20Email%20with%20inline%20graphics.shtml#1ScriptAnchor_)
- [CURL/Email/GMail oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/GMail%20oAuth%20SMTP.shtml#5ScriptAnchor_)
- [CURL/Email/IMAP Email List](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/IMAP%20Email%20List.shtml#1ScriptAnchor_)
- [CURL/Email/IMAP Email Upload](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/IMAP%20Email%20Upload.shtml#1ScriptAnchor_)
- [CURL/Email/IMAP Email](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/IMAP%20Email.shtml#11ScriptAnchor_)
- [CURL/Email/List IMAP folders](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/List%20IMAP%20folders.shtml#1ScriptAnchor_)
- [CURL/Email/Office 365 oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Office%20365%20oAuth%20SMTP.shtml#5ScriptAnchor_)

### Blog Entries

- [IMAP Upload Flags](https://www.mbsplugins.de/archive/2025-06-17/IMAP_Upload_Flags/monkeybreadsoftware_blog_filemaker)
- [Using Gmail with oAuth2 for SMTP with MBS Plugin](https://www.mbsplugins.de/archive/2025-05-08/Using_Gmail_with_oAuth2_for_SM/monkeybreadsoftware_blog_filemaker)
- [SMTP with OAuth for Office 365 in FileMaker](https://www.mbsplugins.de/archive/2022-11-22/SMTP_with_OAuth_for_Office_365/monkeybreadsoftware_blog_filemaker)
- [Sending email with a huge custom function](https://www.mbsplugins.de/archive/2021-06-26/Sending_email_with_a_huge_cust/monkeybreadsoftware_blog_filemaker)
- [Email Script for FileMaker](https://www.mbsplugins.de/archive/2018-10-10/Email_Script_for_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Upload email to Sent folder via IMAP](https://www.mbsplugins.de/archive/2017-12-14/Upload_email_to_Sent_folder_vi/monkeybreadsoftware_blog_filemaker)
- [Sending emails in FileMaker with MBS Plugin](https://www.mbsplugins.de/archive/2016-10-03/Sending_emails_in_FileMaker_wi/monkeybreadsoftware_blog_filemaker)
- [Sending Email with FileMaker via MBS Plugin](https://www.mbsplugins.de/archive/2014-09-29/Sending_Email_with_FileMaker_v/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 2/2025, Seite 22](https://filemaker-magazin.de/neuigkeit/4286-Appetithappen-FMM_202502)
- [Ausgabe 5/2014, Seite 26](https://filemaker-magazin.de/neuigkeit/3759-Appetithappen-FMM_201405)

Created 18th August 2014 , last changed 6th March 2025

  
[CURL.SetOptionPipeWait](CURLSetOptionPipeWait.md) - [CURL.SetOptionPost](CURLSetOptionPost.md)

[HTML Version](CURLSetOptionPort.shtml)