在Visual Studio 2008中使用C#.NET中的电子邮件发送时,我收到以下错误
连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应74.125.53.108:25
但是相同的代码在其他一些PC上工作得很好,但是当我今天测试时它给了我Send()
方法错误...我的网络连接也很好,我正在测试电子邮件代码..
以下是我的电子邮件代码
MailMessage mail = new MailMessage();
mail.To.Add(to);
mail.From = new MailAddress(from);
mail.Subject = subject;
mail.Body = body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new System.Net.NetworkCredential("MyUserName@gmail.com",
"MyPassword");
smtp.EnableSsl = true;
smtp.Send(mail);
Run Code Online (Sandbox Code Playgroud)
可能是这种错误的原因.. ???
我想在Drupal 7中发送电子邮件.那么,有没有人知道如何在Drupal 7上配置Gmail SMTP?
我尝试使用php mail()函数从localhost发送电子邮件到我的雅虎电子邮件帐户,返回说我成功发送了电子邮件,但我没有收到任何电子邮件.我一直在阅读并尝试许多所谓的"简单方式"来发送电子邮件,但结果令人失望,它们都不适合我.以下是代码,配置和错误消息.有人可以用这个启发我吗?谢谢.
PHP代码
<?php
$to = 'myemail@yahoo.com';
$subject = 'Fake sendmail test';
$message = 'If we can read this, it means that our fake Sendmail setup works!';
$headers = 'From: myemail@egmail.com' . "\r\n" .
'Reply-To: myemail@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to, $subject, $message, $headers)) {
echo 'Email sent successfully!';
} else {
die('Failure: Email was not sent!');
}
?>
Run Code Online (Sandbox Code Playgroud)
配置php.ini(我正在使用gmail邮件服务器)
SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = myemail@gmail.com
sendmail_path ="\"C:\ xampp\sendmail\sendmail.exe \" - t"
sendmail.ini的配置
smtp_server …
我一直在寻找如何创建在Gmail中发送或接收电子邮件时触发的webhook.例如,有人发送电子邮件,该电子邮件作为JSON对象被POST为我的一个应用程序.我发现很多中间人应用程序/服务都是这样做的(zapier提供了我想要的所有功能,但它需要花钱),但是我找不到任何关于如何自己实际执行此操作的文档,所以我不需要付费它.
这可能吗?
我是一个PHP开发人员,有点像泡菜.我正在尝试找到和/或构建一个能够与Hotmail,Yahoo和GMAIL通话的API,以便检索联系人列表(当然,在用户的同意下).我发现最麻烦的是Hotmail API.
在哪里可以找到工作的,稳定的API或我可以采取的步骤来开发一个用于Hotmail的步骤?是否有一个涵盖我可以实施的所有这些基础?任何帮助将不胜感激!
谢谢!
编辑:我确实设法获得了一些服务,但是,我一直在使用Open Inviter至少一个客户端项目,它似乎表现良好.
我正在Django制作一个Web应用程序,将用户的图像发送到他们的电子邮件中.
发送图像对我来说最吸引人的方式是数据:uri格式.
但是,我测试了发送此电子邮件的数据:uri图像到我的GMail帐户,电子邮件显示,但没有图像!
我知道Chrome和Firefox都可以打开数据:uri图像.所以这不是浏览器问题.但我没有看到数据:在GMail中的uri图像.
GMail不支持数据:uri图像?或者我可能发错了?
我想直接从脚本发送电子邮件到Gmail电子邮件帐户,直接连接到smtp.gmail.com
.
但是,我宁愿不在脚本中使用gmail密码.根据我的阅读,Gmail似乎需要进行身份验证才能发送任何邮件,包括发送给自己的用户.
我的问题是,来自另一台SMTP服务器的邮件是如何传递的,因为该SMTP服务器不具有Gmail凭据.Gmail是否仅要求对" 匿名 "发件人进行身份验证,而且由于我的脚本在个人计算机上运行,因此它具有更高的安全性?这是我正在运行的python脚本:
import smtplib
import email
msg = email.message.Message()
msg["From"] = "user@gmail.com"
msg["To"] = "user@gmail.com"
msg["Subject"] = "Test message"
server = smtplib.SMTP("smtp.gmail.com",587)
server.starttls()
server.ehlo_or_helo_if_needed()
try:
failed = server.sendmail("user@gmail.com","user@gmail.com", msg.as_string())
server.close()
except Exception as e:
print(e)
Run Code Online (Sandbox Code Playgroud)
当我运行此脚本时,输出为:
(530, b'5.5.1 Authentication Required. Learn more at
5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 fw5sm21125889wib.0', 'user@gmail.com')
Run Code Online (Sandbox Code Playgroud)
我的问题是,外部SMTP服务器如何避免这个问题?它们是否可以在本地脚本中复制,还是需要正确的反向DNS记录,SPF记录等?
在Gmail中,如果您收到来自新闻列表的电子邮件,则会在电子邮件地址旁边显示"取消订阅"链接,如下所示:
Google+ <noreply-67e4f7ae@plus.google.com> Unsubscribe
Run Code Online (Sandbox Code Playgroud)
标题名称List-Unsubscribe:
标识了网址或电子邮件.
在Gmail中,我可以看到电子邮件原件以查看标题:
Received-SPF: pass (google.com: domain of root@domain.net designates 123.123.123.123 as permitted sender) client-ip=123.123.123.123;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of root@domain.net designates 123.123.123.123 as permitted sender) smtp.mail=root@domain.net;
dkim=pass header.i=@domain.com
List-Unsubscribe: <http://domain.com/uns.html?test=wdqwqw>
Run Code Online (Sandbox Code Playgroud)
我有List-Unsubscribe
标题集,spf和dkim验证通过.
有什么不对?为什么gmail没有显示取消订阅链接?
我执行代码时遇到以下错误:
An error occurred: <HttpError 403 when requesting https://www.googleapis.com/gmail/v1/users/me/messages/send?alt=json returned "Insufficient Permission">
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
import httplib2
import os
from httplib2 import Http
from apiclient import discovery
import oauth2client
from oauth2client import client
from oauth2client import tools
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
flags = None
#SCOPES = 'https://www.googleapis.com/'
SCOPES = 'https://www.googleapis.com/auth/gmail.compose'
CLIENT_SECRET_FILE = 'client_secret.json'
APPLICATION_NAME = 'Gmail API Quickstart'
def get_credentials():
"""Gets valid user credentials from storage.
If nothing has been stored, or if the stored credentials are invalid, …
Run Code Online (Sandbox Code Playgroud) 我在localhost上运行相同的php脚本 - 我的PC与XAMPP和托管服务器上运行.它适用于我的PC,但不适用于托管服务器.
当我从托管服务器发送它时,我得到以下输出:
SMTP -> ERROR: Password not accepted from server: 535 Incorrect authentication data
SMTP -> ERROR: RCPT not accepted from server: 550-Please turn on SMTP Authentication in your mail client, or login to the 550-IMAP/POP3 server before sending your message. dev.camppage.com 550-(patchvalues.com) [205.234.141.238]:50958 is not permitted to relay through 550 this server without authentication.
SMTP Error: The following recipients failed: jdorner4@gmail.com FAILED
Run Code Online (Sandbox Code Playgroud)
我怀疑有一个配置设置需要在服务器上更改,但我不知道哪一个.任何建议将不胜感激!
这是代码:
function send_gmail ($recipients, $subject, $message, $attachment_filenames = array())
{
global $email_address, $email_password, $email_name; …
Run Code Online (Sandbox Code Playgroud) gmail ×10
email ×5
php ×3
api ×2
python ×2
smtp ×2
c# ×1
data-uri ×1
drupal-7 ×1
hotmail ×1
integration ×1
phpmailer ×1
sendmail.exe ×1
smtpclient ×1
unsubscribe ×1
webhooks ×1
yahoo ×1