diff --git a/src/pages/email-server/how-tos/connect-via-platform/django.mdx b/src/pages/email-server/how-tos/connect-via-platform/django.mdx
index 42e3c9d8..6a9e6700 100644
--- a/src/pages/email-server/how-tos/connect-via-platform/django.mdx
+++ b/src/pages/email-server/how-tos/connect-via-platform/django.mdx
@@ -86,8 +86,8 @@ EMAIL_HOST = config('MAIL_HOST')
EMAIL_PORT = config('MAIL_PORT', cast=int)
EMAIL_HOST_USER = config('MAIL_USER')
EMAIL_HOST_PASSWORD = config('MAIL_PASSWORD')
-EMAIL_USE_TLS = False # Disable TLS
-EMAIL_USE_SSL = True # Force SSL
+EMAIL_USE_TLS = False # Disable STARTTLS
+EMAIL_USE_SSL = True # Force TLS
DEFAULT_FROM_EMAIL = f"{config('MAIL_FROM_NAME')} <{config('MAIL_FROM_ADDRESS')}>"
`}
diff --git a/src/pages/email-server/how-tos/connect-via-platform/dotnet.mdx b/src/pages/email-server/how-tos/connect-via-platform/dotnet.mdx
index 0ff3783c..79f0f556 100644
--- a/src/pages/email-server/how-tos/connect-via-platform/dotnet.mdx
+++ b/src/pages/email-server/how-tos/connect-via-platform/dotnet.mdx
@@ -63,7 +63,17 @@ MAIL_FROM_ADDRESS=info@example.com`}
مقدار فیلد
-با تنظیم
Sent from Go using gomail and SMTP with TLS.
- \`) - - // Create SMTP dialer with TLS - d := gomail.NewDialer(mailHost, mailPort, mailUser, mailPassword) - - // Send the email - if err := d.DialAndSend(m); err != nil { - log.Fatalf("Failed to send email: %v", err) - } - - fmt.Println("Test email sent successfully!") + // Fetch environment variables + host := os.Getenv("MAIL_HOST") + + port, err := strconv.Atoi(os.Getenv("MAIL_PORT")) + if err != nil { + panic(err) + } + + user := os.Getenv("MAIL_USER") + password := os.Getenv("MAIL_PASSWORD") + from := os.Getenv("MAIL_FROM") + + // Define the email recipient, subject, and body + to := "recipient@example.com" + subject := "Test Email" + body := "This is a test email." + + // Set up the email message + msg := gomail.NewMessage() + msg.SetHeader("From", from) + msg.SetHeader("To", to) + msg.SetHeader("Subject", subject) + msg.SetHeader("x-liara-tag", "test-tag") + msg.SetBody("text/plain", body) + + // Set up the SMTP client + dialer := gomail.NewDialer(host, port, user, password) + dialer.SSL = true // force SSL + + // Send the email + err = dialer.DialAndSend(msg) + if err != nil { + log.Fatalf("Failed to send email: %s", err) + } else { + fmt.Println("Email sent successfully!") + } } `} diff --git a/src/pages/email-server/how-tos/connect-via-platform/php.mdx b/src/pages/email-server/how-tos/connect-via-platform/php.mdx index 5b4d7352..5d314c42 100644 --- a/src/pages/email-server/how-tos/connect-via-platform/php.mdx +++ b/src/pages/email-server/how-tos/connect-via-platform/php.mdx @@ -125,7 +125,8 @@ try { $mail->Subject = 'Test Email'; $mail->Body = 'This is a test email using SMTP.
'; $mail->AltBody = 'Hello from PHPMailer! This is a test email using SMTP.'; - + $mail->addCustomHeader('x-liara-tag', 'test-tag'); // use Liara Tags + // Send the email $mail->send(); echo 'Email sent successfully!'; diff --git a/src/pages/email-server/how-tos/connect-via-platform/python.mdx b/src/pages/email-server/how-tos/connect-via-platform/python.mdx index cfac6d24..d6d59825 100644 --- a/src/pages/email-server/how-tos/connect-via-platform/python.mdx +++ b/src/pages/email-server/how-tos/connect-via-platform/python.mdx @@ -99,6 +99,7 @@ def send_email(to_address, subject, body): msg['From'] = f"{MAIL_FROM_NAME} <{MAIL_FROM_ADDRESS}>" msg['To'] = to_address msg['Subject'] = subject + msg.add_header('x-liara-tag', 'test-tag') # Add custom header msg.attach(MIMEText(body, 'plain')) # Send the email