相关疑难解决方法(0)

通过Gmail在.NET中发送电子邮件

我没有依赖我的主机发送电子邮件,而是考虑使用我的Gmail帐户发送电子邮件.这些电子邮件是我在节目中播放的乐队的个性化电子邮件.有可能吗?

.net c# email gmail smtp

852
推荐指数
18
解决办法
53万
查看次数

如何通过Gmail使用简单的SMTP命令发送电子邮件?

出于教育目的,我需要使用SMTP的基本和简单规则通过SMTP服务器发送电子邮件.

我能够使用smtp4dev做到这一点.我telnet localhost 25和命令是:

在此输入图像描述

我想使用Gmail SMTP服务器做同样的事情.但是,它需要身份验证和TLS.我无法弄清楚如何为Gmail做到这一点.这是截图telnet smtp.gmail.com 587:

在此输入图像描述

我搜索并发现了很多链接,包括维基百科关于STARTTLS命令的文章.但是我无法使用TLS并使用命令行对Gmail的SMTP服务器进行身份验证(或者使用编程语言自行发送命令).有人可以帮忙吗?

email gmail smtp smtpclient smtp-auth

64
推荐指数
3
解决办法
18万
查看次数

Rails Mailer"Net :: OpenTimeout:execution expired"仅限生产服务器上的异常

我在Ubuntu 12.04 TLS VPS上使用Ruby MRI 2.0.0和Rails 3.2.12,并尝试在我的应用程序中设置电子邮件通知.几天前工作正常,但现在不行了.我的网站主机是OVH.

我的SMTP设置:

config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :user_name            => 'sender@gmail.com',
  :password             => 'secret',
  :authentication       => 'plain',
  :enable_starttls_auto => true
}
Run Code Online (Sandbox Code Playgroud)

使用RAILS_ENV=production rails console:

class MyMailer < ActionMailer::Base
  def test_email
    sender     = "sender@gmail.com"
    receiver   = "receiver@example.com"
    mail from: sender, to: receiver, subject: "Hello!", body: "World!!"
  end
end
 => nil

MyMailer.test_email.deliver
Run Code Online (Sandbox Code Playgroud)

输出:

Net::OpenTimeout: execution expired
    from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:540:in `initialize'
    from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:540:in `open'
    from …
Run Code Online (Sandbox Code Playgroud)

smtp ruby-on-rails actionmailer exception-notification

35
推荐指数
5
解决办法
3万
查看次数

使用PHP发送的邮件花费了太多时间

我用PHP编写了一个类,用于发送使用Gmail帐户的邮件.该类又使用PHPMailer库.该设置是Windows Vista上的WAMP 2.4.使用microtime()PHP中的函数,我发现发送一封邮件需要5到6秒.在这种设置上运行的PHP脚本是否正常,我需要花费5-6秒才能发送一封邮件.这是该类的代码.

<?php

require_once("phpmailer/class.phpmailer.php");
require_once("phpmailer/class.smtp.php");

class Mailer {

    // Needs to be set per object
    public $subject;
    public $message;
    public $to_name;
    public $to;

    private $mail; // This is the main mail object that'll be initialized 

    public function __construct() {

        // Need to create a PHPMailer object in the constuctor and return it for use in this class. 

        $mail = new PHPMailer();

        $from_name = "bleh";
        $from = "bleh@gmail.com";
        $username = "bleh";
        $password = "bleh";

        $mail->FromName = $from_name;
        $mail->From …
Run Code Online (Sandbox Code Playgroud)

php performance phpmailer

4
推荐指数
1
解决办法
5018
查看次数