Sending emails through local proxy
01:56 02 Feb 2026

I need to bypass Iran's internet censorship to send emails using R's emayili package. The standard gmail() function fails because the regime blocks the default SMTP protocol.

My goal: Use local HTTP/HTTPS/SOCKS proxies to route emayili's email traffic through a local proxy server (192.168.1.50:8080).

Current setup that doesn't work:

message_content <- "something"

smtp <- gmail(
    username = sender_email,
    password = sender_email_pass  # Gmail app password
)

smtp(message_content)  # Fails due to blocking

What I've tried without success:

# Direct proxy specification
smtp <- gmail(
    username = sender_email,
    password = sender_email_pass,
    proxy = "https://192.168.1.50",
    proxyport = 8080
)

# Colon-separated format
smtp <- gmail(
    username = sender_email,
    password = sender_email_pass,
    proxy = "192.168.1.50:8080",
    proxyport = 8080
)

# Environment variables
Sys.setenv(
    http_proxy = "http://192.168.1.50:8080",
    https_proxy = "http://192.168.1.50:8080"
)

# Direct HTTPS proxy URL
smtp <- gmail(
    username = sender_email,
    password = sender_email_pass,
    proxy = "https://192.168.1.50:8080"
)

# List format
smtp <- gmail(
    username = sender_email,
    password = sender_email_pass,
    list(proxy = "https://192.168.1.50:8080")
)
  1. What's the correct curl option syntax for setting an HTTP/HTTPS proxy in emayili?
  2. Does Gmail's SMTP (port 465/587) even work through HTTP proxies, or do I need a SOCKS proxy?

Proxy details:

  • Proxy server: 192.168.1.50:8080
  • Protocol: HTTP/HTTPS/SOCKS5 (available)
  • Authentication: None required
  • Local network access: Confirmed working for web browsing

I'd appreciate your insight on the correct curl configuration or alternative approaches to make emayili work through proxies in a censored environment.

r email proxy smtp