이 문서에서는 가상 머신(VM) 인스턴스에서 메일을 보내는 옵션과 이메일을 보내도록 인스턴스를 설정하는 방법에 대한 일반적인 권장사항을 설명합니다.
표준 이메일 포트 사용
Google Cloud 는 대상 TCP 포트 587 또는 465를 사용하여 외부 대상 IP 주소로 전송되는 트래픽에 대해 어떠한 제한도 두지 않습니다. 묵시적인 이그레스 허용 방화벽 규칙은 해당 트래픽을 차단하는 이그레스 거부 방화벽 규칙을 만들지 않는 한 이 트래픽을 허용합니다.
악용의 위험으로 인해 대상이 VPC 네트워크 외부에 있을 때 대상 TCP 포트 25로의 연결은 차단됩니다. 여기에는 Google Workspace에서 SMTP 릴레이를 사용하는 것도 포함됩니다. 하지만 일부 프로젝트에는 이러한 제한 없고 포트 25에서 외부 SMTP 이그레스가 허용됩니다. 자세한 내용은 차단 및 제한된 트래픽을 참조하세요.
사용할 타사 이메일 서비스 선택
표준 이메일 포트 사용 외에도 SendGrid, Mailgun, Mailjet와 같은 신뢰할 수 있는 타사 이메일 공급자를 사용하면 IP 평판 점수가 향상됩니다.
SendGrid, Mailgun, Mailjet은 Compute Engine 고객이 자사 서버를 통해 이메일을 설정하고 보낼 수 있는 무료 등급을 제공합니다. Google Workspace 계정이 없는 경우 이러한 타사 파트너를 이용하여 클릭 추적, 분석, API과 더불어 이메일 니즈를 충족할 수 있는 다른 기능을 활용하세요.
Google Workspace 계정이 없거나 Google Workspace 또는 타사 메일 제공업체를 사용하지 않으려는 경우에는 비표준 포트를 사용하여 인스턴스에서 자체 이메일 서버를 설정하면 됩니다. Compute Engine에서 차단하지 않는 모든 임시 포트를 선택할 수 있습니다.
Google Workspace 도메인을 사용하려면: Google Workspace 문서의 SMTP 릴레이 서비스 설정 안내를 따릅니다. Google Workspace를 통한 SMTP 릴레이는 포트 465 또는 587을 통해서만 허용됩니다. 포트 25는 Google Workspace에서 지원되지 않습니다.
커스텀 포트에서 사용자 고유의 이메일 서버를 사용하려면 사용하는 이메일 서비스와 관련된 문서를 참조하여 커스텀 이메일 포트를 구성합니다.
커스텀 포트에서 아웃바운드 트래픽을 허용하도록 방화벽 규칙 설정
커스텀 포트를 통해 아웃바운드 트래픽을 허용하려면 방화벽 규칙을 설정해야 합니다. 예를 들어 다음은 포트 2525에서 아웃바운드 트래픽을 허용하는 규칙을 설정하는 단계입니다. 포트 2525를 원하는 커스텀 포트로 바꿉니다.
대상에서 이 규칙에 적합한 대상을 선택합니다. 예를 들어 특정 태그가 있는 인스턴스에 규칙을 적용하려면 지정된 대상 태그를 선택하면 됩니다.
VM 인스턴스에서 임의의 대상으로 나가는 이그레스 트래픽을 허용하려면 대상 필터에서 0.0.0.0/0을 설정합니다. 대상을 제한하려면 여기에 다른 IP 범위를 입력합니다.
프로토콜 및 포트에서 지정된 프로토콜 및 포트, tcp를 차례로 선택하고 2525를 입력합니다.
만들기를 클릭하여 변경사항을 저장합니다.
회사 메일 서버를 통해 메일 전송
경우에 따라 이미 이메일 서비스를 실행하고 있는 회사 메일 서버가 있을 수 있습니다. 회사 메일 서버를 통해 메일을 전송해야 하지만 이 페이지 상단에 설명된 포트 제한 때문에 차단되는 경우 VPN을 사용하여 이러한 제한을 우회할 수 있습니다. 이 방법을 사용하려면 Compute Engine 클러스터에서 VPN 클라이언트가 실행되고 있어야 하며 회사 네트워크 라우터에 VPN 서버가 있어야 합니다. 이 설정을 사용하면 인스턴스가 회사 방화벽 '내에' 나타날 수 있으며 회사 메일 서버에 제한 없이 액세스할 수 있습니다.
이 구성에는 보안과 관련된 부분이 있으므로 Compute Engine 인스턴스가 필요한 서비스에만 액세스할 수 있도록 해야 합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-03(UTC)"],[[["\u003cp\u003eGoogle Cloud allows sending email through standard ports 587 and 465, but blocks port 25 for external destinations to prevent abuse, though some projects might have exceptions to this rule.\u003c/p\u003e\n"],["\u003cp\u003eUtilizing third-party email services like SendGrid, Mailgun, or Mailjet is recommended for enhanced IP reputation, with free tiers available for Compute Engine customers.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Workspace users can relay email through their accounts via ports 465 or 587, but are subject to email activity limits.\u003c/p\u003e\n"],["\u003cp\u003eUsers can host their own email servers on VM instances using non-standard ports, which requires configuring a firewall rule to allow outbound traffic on that specific port.\u003c/p\u003e\n"],["\u003cp\u003eTo send mail through corporate servers bypassing port restrictions, a VPN setup can be employed, but it's essential to consider the security implications and limit access accordingly.\u003c/p\u003e\n"]]],[],null,["*** ** * ** ***\n\nThis document describes the options for sending mail from a virtual\nmachine (VM) instance and provides general recommendations on how to set up your\ninstances to send email.\n\nUsing standard email ports\n\nGoogle Cloud does not place any restrictions on traffic sent to external\ndestination IP addresses using destination TCP ports 587 or 465. The\n[implied allow egress firewall rule](/vpc/docs/firewalls#default_firewall_rules)\nallows this traffic unless you've created egress deny firewall rules that block\nit.\n\nDue to the risk of abuse, connections to destination TCP Port 25 are blocked\nwhen the destination is external to your VPC network. This\nincludes using SMTP relay with Google Workspace. However, some projects do not\nhave this restriction and do allow external SMTP egress on port 25. For more\ninformation, see [Blocked and limited\ntraffic](/vpc/docs/firewalls#blockedtraffic).\n| **Note:** Subject to Google Cloud firewall rules, connections to destination TCP Port 25 are allowed within your VPC network, a VPC connected using VPC Network Peering, or an on-premises network connected to your VPC network using Cloud VPN tunnels or Cloud Interconnect attachments (VLANs).\n\nChoosing a third-party email service to use\n\nIn addition to using standard email ports, having a trusted third-party email\nprovider such as SendGrid, Mailgun, or Mailjet improves your\n[IP reputation score](https://sendgrid.com/blog/email-reputation-and-email-engagement-metrics/).\n\nSendGrid, Mailgun, and Mailjet offer a free tier for Compute Engine\ncustomers to set up and send email through their servers. If you don't have a\nGoogle Workspace account, use these third-party partners to take advantage of\nfeatures like click tracking, analytics, APIs, and other features to meet your\nemail needs.\n\nAlternatively, if you are familiar with\n[Google Workspace](https://gsuite.google.com) and are already paying for a\nGoogle Workspace account that supports email, you can [set up a relay service\nto send email through\nGoogle Workspace](https://support.google.com/a/answer/176600). Note that\nGmail and Google Workspace enforce\n[limits for email activity](https://support.google.com/a/answer/166852).\n\nIf you don't have a Google Workspace account or don't want to use\nGoogle Workspace or a third-party mail provider, you can set up your own\nemail server on an instance by using a non-standard port. You can choose any\n[ephemeral port](https://wikipedia.org/wiki/Ephemeral_port)\nthat isn't blocked by Compute Engine.\n\n- **To use SendGrid, Mailgun, or Mailjet** : Follow the instructions for [Sending Email using SendGrid](/compute/docs/tutorials/sending-mail/using-sendgrid), [Sending Email using Mailgun](/compute/docs/tutorials/sending-mail/using-mailgun), or [Sending Email using Mailjet](/compute/docs/tutorials/sending-mail/using-mailjet).\n- **To use a Google Workspace domain** : Follow the instructions for [SMTP relay service](https://support.google.com/a/answer/2956491) settings in the Google Workspace documentation. SMTP relaying through Google Workspace is only allowed through ports 465 or 587. Port 25 is not supported through Google Workspace.\n\nIf you want to use your own email server on a custom port, use the\ndocumentation specific to your email service to configure a custom\nemail port.\n\nSetting up a firewall rule to allow outbound traffic on a custom port\n\nTo allow outbound traffic through a custom port, you need to set up a firewall\nrule. For example, the following steps set up a rule that allows outbound\ntraffic on port 2525. Replace port 2525 with the custom port of your choice.\n\n1. In the Google Cloud console, go to the **Create a firewall rule** page.\n\n [Go to Create a firewall rule](https://console.cloud.google.com/networking/firewalls/add)\n2. Choose a name for the firewall rule.\n\n3. Under **Network**, select the network that is hosting the VM instance that\n you intend to send email messages from.\n\n4. Under **Direction of traffic** , select **Egress**.\n\n5. Under **Targets** , choose the appropriate target for this rule. For example,\n you might choose **Specified target tags** if you want the rule to apply\n to instances that have a [specific tag](/vpc/docs/add-remove-network-tags).\n\n6. Under **Destination filter** , set `0.0.0.0/0` if you want to allow egress\n traffic from the VM instance to any destination. If you want to limit the\n destination, enter another IP range here.\n\n7. Under **Protocols and ports** , select **Specified protocols and ports** ,\n select **tcp** , and enter `2525`.\n\n8. Click **Create** to save your changes.\n\nSending mail through corporate mail servers\n\nIn some cases, you might have a corporate mail server that is already running\nan email service for you. If you need to send mail through a corporate mail\nserver but are blocked by the port restrictions described at the top of\nthis page, you can use a VPN to bypass these restrictions. This method requires\nrunning a VPN client on your Compute Engine cluster, and a VPN server\non your corporate network router. This setup lets your instance appear\n\"inside\" your corporate firewall, and allows unrestricted access to your\ncorporate mail server.\n\nThere are security implications for this configuration, and you should ensure\nthat your Compute Engine instance has access to **only** the services\nit requires, and nothing more.\n\nWhat's next\n\n- Send emails from your instance [using Sendgrid](/compute/docs/tutorials/sending-mail/using-sendgrid).\n- Send emails from your instance [using Mailgun](/compute/docs/tutorials/sending-mail/using-mailgun).\n- Send emails from your instance [using Mailjet](/compute/docs/tutorials/sending-mail/using-mailjet).\n- Read the Google Workspace domain documentation to learn how to use the [SMTP relay service](https://support.google.com/a/answer/2956491)."]]