当尝试使用 Nodemailer ( https://github.com/nodemailer/nodemailer )在 Node 内发送电子邮件时,与 Ethereal 测试电子邮件帐户结合使用时sendMail,对 Nodemailer 传输器的调用会引发错误Greeting never received。
我尝试使用“回调方法”和“异步/等待”方法,但在这两种情况下都会引发相同的错误。这两个示例都非常直接来自 Nodemailer 文档中的工作示例。也许我错过了一些简单的东西?:)
这是产生错误的“回调方法”代码:
it('can send email with a dynamic test account', done => {
nodemailer.createTestAccount((err, account) => {
const transporter = nodemailer.createTransport({
host: 'smtp.ethereal.email',
port: 587,
auth: {
user: account.user, // generated ethereal user
pass: account.pass // generated ethereal password
}
});
const mailOptions = {
from: '"Fred Foo " <foo@example.com>', // sender address
to: 'bar@example.com, baz@example.com', // list of receivers
subject: …Run Code Online (Sandbox Code Playgroud) 我有一个配置为接收远程通知的Xamarin iOS应用程序.当设备收到远程通知时,远程通知处理程序未按预期执行.
DidReceiveRemoteNotification的实现包括对应用程序的引用,通知用户信息字典以及使用适当的UIBackgroundFetchResult状态执行的完成处理程序.
public override void DidReceiveRemoteNotification (UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
{
// retrieve something from a server somewhere
}
Run Code Online (Sandbox Code Playgroud)
根据Apple的iOS开发人员文档,在向用户显示远程通知后,将执行'application:didReceiveRemoteNotification:fetchCompletionHandler'.
这包括应用程序处于运行状态,后台运行状态以及"未运行"状态.接收通知应启动应用程序,然后在调用此方法之前将其置于后台状态.
参考:https: //developer.apple.com/library/ios/documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#jumpTo_12
在我的设备上运行时,远程通知已成功传递.但是,在XCode Organizer中跟踪设备的控制台日志时,应用程序永远不会启动,并且永远不会执行"DidReceiveRemoteNotification"方法.
我做了以下事情:
如果这个线程是正确的,这看起来像Xamarin实现中的一个问题,但我希望其他人之前遇到过这个问题,并且可以确认或提供其他信息. http://forums.xamarin.com/discussion/8765/handling-silent-remote-notifications