My server.js file contains the following code segments which should configure a gmail address and send an email.
Meteor.startup(() => {
// code to run on server at startup
process.env.MAIL_URL = 'smtps://email_address#gmail.com:password_without_special_keys#smtp.gmail.com:465';
Email.send({
from: "from_adddress#gmail.com",
to: "to_address#gmail.com",
subject: "Meteor Can Send Emails via Gmail",
text: "Its pretty easy to send emails via gmail."
})
});
Shouldn't my meteor app send an email when i run the app with the command
meteor
??
But it is providing the following errors. What's wrong?
W20170718-15:36:37.701(6)? (STDERR) /home/forhadmethun/.meteor/packages/meteor-tool/.1.5.1.dvn6c8++os.linux.x86_32+web.browser+web.cordova/mt-os.linux.x86_32/dev_bundle/server-lib/node_modules/fibers/future.js:313
W20170718-15:36:37.766(6)? (STDERR) throw(ex);
W20170718-15:36:37.767(6)? (STDERR) ^
W20170718-15:36:37.769(6)? (STDERR)
W20170718-15:36:37.769(6)? (STDERR) Error: Connection timeout
W20170718-15:36:37.770(6)? (STDERR) at Object.Future.wait (/home/forhadmethun/.meteor/packages/meteor-tool/.1.5.1.dvn6c8++os.linux.x86_32+web.browser+web.cordova/mt-os.linux.x86_32/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
W20170718-15:36:37.771(6)? (STDERR) at Mail._syncSendMail (packages/meteor.js:213:24)
W20170718-15:36:37.772(6)? (STDERR) at smtpSend (packages/email.js:116:13)
W20170718-15:36:37.773(6)? (STDERR) at Object.Email.send (packages/email.js:174:5)
W20170718-15:36:37.774(6)? (STDERR) at server/main.js:28:11
W20170718-15:36:37.775(6)? (STDERR) at Function.time (/home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/profile.js:309:28)
W20170718-15:36:37.776(6)? (STDERR) at /home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/boot.js:347:13
W20170718-15:36:37.777(6)? (STDERR) at /home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/boot.js:388:5
W20170718-15:36:37.779(6)? (STDERR) at Function.run (/home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/profile.js:510:12)
W20170718-15:36:37.780(6)? (STDERR) at /home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/boot.js:386:11
W20170718-15:36:37.781(6)? (STDERR) - - - - -
W20170718-15:36:37.782(6)? (STDERR) at SMTPConnection._formatError (/home/forhadmethun/.meteor/packages/email/.1.2.3.3ikb16++os+web.browser+web.cordova/npm/node_modules/node4mailer/lib/smtp-connection/index.js:558:19)
W20170718-15:36:37.784(6)? (STDERR) at SMTPConnection._onError (/home/forhadmethun/.meteor/packages/email/.1.2.3.3ikb16++os+web.browser+web.cordova/npm/node_modules/node4mailer/lib/smtp-connection/index.js:531:20)
W20170718-15:36:37.785(6)? (STDERR) at [object Object].<anonymous> (/home/forhadmethun/.meteor/packages/email/.1.2.3.3ikb16++os+web.browser+web.cordova/npm/node_modules/node4mailer/lib/smtp-connection/index.js:249:18)
W20170718-15:36:37.787(6)? (STDERR) at Timer.listOnTimeout (timers.js:92:15)
Your MAIL_URL variable should look like
smtps://username%40gmail.com:password#smtp.gmail.com:465
If this won't help, you will need to allow the less secure applications and allow access to your account. This steps if done correctly should allow sending emails from Gmail. You can read more about Gmail security rules by looking at this answer.
Related
Based on the simple implementation of Meteor Cluster MicroServices the doc I have this implementation for 2 services to communicate.
AppUI
export default CLUSTER_DISCOVERY_URL="mongodb://localhost:3000/meteor";
Cluster.connect(CLUSTER_DISCOVERY_URL);
Cluster.register('appui_service');
loggerService = Cluster.discoverConnection('logger_service');
LoggerService
export default CLUSTER_DISCOVERY_URL="mongodb://localhost:3300/meteor";
Cluster.connect(CLUSTER_DISCOVERY_URL);
Cluster.register('logger_service');
loggerService = Cluster.discoverConnection('appui_service');
As it is, AppiUI runs on port 3000, while LoggerService is on port 3300. When I tried, started the servers, I kept on getting this error log.
I20180719-10:17:27.259(1)? Cluster: connecting to 'mongodb' discovery backend
I20180719-10:17:27.260(1)? Cluster: with options: undefined
W20180719-10:17:27.274(1)? (STDERR) /Users/kehindeadeoya/.meteor/packages/meteor-tool/.1.7.0_3.w8zcf.uowlh++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:313
W20180719-10:17:27.274(1)? (STDERR) throw(ex);
W20180719-10:17:27.274(1)? (STDERR) ^
W20180719-10:17:27.275(1)? (STDERR)
W20180719-10:17:27.275(1)? (STDERR) Error: failed to connect to [localhost:27017]
W20180719-10:17:27.275(1)? (STDERR) at exports.ConnectionPool.<anonymous> (/Users/kehindeadeoya/.meteor/packages/meteorhacks_cluster/.1.6.9.y65r.xg1qe3++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/server.js:555:25)
W20180719-10:17:27.275(1)? (STDERR) at emitThree (events.js:136:13)
W20180719-10:17:27.275(1)? (STDERR) at exports.ConnectionPool.emit (events.js:217:7)
W20180719-10:17:27.275(1)? (STDERR) at exports.Connection.<anonymous> (/Users/kehindeadeoya/.meteor/packages/meteorhacks_cluster/.1.6.9.y65r.xg1qe3++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
W20180719-10:17:27.276(1)? (STDERR) at emitTwo (events.js:126:13)
W20180719-10:17:27.276(1)? (STDERR) at exports.Connection.emit (events.js:214:7)
W20180719-10:17:27.276(1)? (STDERR) at Socket.<anonymous> (/Users/kehindeadeoya/.meteor/packages/meteorhacks_cluster/.1.6.9.y65r.xg1qe3++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
W20180719-10:17:27.276(1)? (STDERR) at emitOne (events.js:116:13)
W20180719-10:17:27.276(1)? (STDERR) at Socket.emit (events.js:211:7)
W20180719-10:17:27.277(1)? (STDERR) at emitErrorNT (internal/streams/destroy.js:64:8)
W20180719-10:17:27.277(1)? (STDERR) at _combinedTickCallback (internal/process/next_tick.js:138:11)
W20180719-10:17:27.277(1)? (STDERR) at process._tickDomainCallback (internal/process/next_tick.js:218:9)
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.
I don't understand what the discovery backend means. Secondly, I want to use Meteor's default bundled Mongo for this test, not a stand-alone Mongo, what can I do to get pass this error?
I'm new to meteor and playing with Telescope for past few days. Yesterday, I updated the Packages. From then on I'm not able to run the Telescope app in my Mac.
=> Started proxy.
=> Started MongoDB.
I20151128-19:27:24.429(8)? Kadira: completed instrumenting the app
W20151128-19:27:24.432(8)? (STDERR)
W20151128-19:27:24.432(8)? (STDERR) /Users/bala/.meteor/packages/meteor-tool/.1.1.10.jru118++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151128-19:27:24.432(8)? (STDERR) throw(ex);
W20151128-19:27:24.433(8)? (STDERR) ^
W20151128-19:27:24.433(8)? (STDERR) Error: deny: Value for `update` must be a function
W20151128-19:27:24.433(8)? (STDERR) at packages/mongo/collection.js:755:1
W20151128-19:27:24.433(8)? (STDERR) at Array.forEach (packages/es5-shim/.npm/package/node_modules/es5-shim/es5-shim.js:417:1)
W20151128-19:27:24.433(8)? (STDERR) at Function._.each._.forEach (packages/underscore/underscore.js:105:1)
W20151128-19:27:24.433(8)? (STDERR) at [object Object].addValidator (packages/mongo/collection.js:752:1)
W20151128-19:27:24.433(8)? (STDERR) at [object Object].Mongo.Collection.deny (packages/mongo/collection.js:804:1)
W20151128-19:27:24.433(8)? (STDERR) at Posts.getNotificationProperties.properties.postAuthorName (lib/herald.js:7:21)
W20151128-19:27:24.433(8)? (STDERR) at /Users/bala/meteor/Telescope/.meteor/local/build/programs/server/boot.js:249:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
Can anyone pls help me on this.
*Herald.js file is below
if (Meteor.absoluteUrl().indexOf('localhost') !== -1)
Herald.settings.queueTimer = 1000;
Meteor.startup(function () {
Herald.collection.deny({ update: !Users.can.editById, remove: !Users.can.editById });
// disable all email notifications when "emailNotifications" is set to false
Herald.settings.overrides.email = !Settings.get('emailNotifications', true); });
This is an issue with the recent Meteor 1.2 update. I would start by making sure you're using the latest version of all Telescope packages.
I have'd similar error with my meteor app, solved like this:
Close browser, exit terminal, reboot, open terminal, start app. It's something with browser.
Hi received the following error after upgrading to latest version:
W20150112-12:30:33.785(-5)? (STDERR)
W20150112-12:30:33.788(-5)? (STDERR) /Users/chazmee/.meteor/packages/meteor-tool/.1.0.37.1c4ifox++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:173
W20150112-12:30:33.788(-5)? (STDERR) throw(ex);
W20150112-12:30:33.788(-5)? (STDERR) ^
W20150112-12:30:33.789(-5)? (STDERR) ReferenceError: Router is not defined
W20150112-12:30:33.789(-5)? (STDERR) at app/lib/router.js:1:36
W20150112-12:30:33.789(-5)? (STDERR) at app/lib/router.js:69:3
W20150112-12:30:33.789(-5)? (STDERR) at /Users/chazmee/placelist/.meteor/local/build/programs/server/boot.js:175:10
W20150112-12:30:33.789(-5)? (STDERR) at Array.forEach (native)
W20150112-12:30:33.790(-5)? (STDERR) at Function..each..forEach (/Users/chazmee/.meteor/packages/meteor-tool/.1.0.37.1c4ifox++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20150112-12:30:33.790(-5)? (STDERR) at /Users/chazmee/placelist/.meteor/local/build/programs/server/boot.js:86:5
=> Exited with code: 8
Based on the error, it looks like you have a Router declaration, but it isn't defined. I would recommend installing iron router:
meteor add iron:router
Then reload your app.
I am new-bee to meteor, i am struggling to run this.
kanna#kanna-VPCEB3QFX:~/Desktop/testhtml5/testhtml5/testHTML$ sudo meteor
[sudo] password for kanna:`enter code here`
[[[[[ ~/Desktop/testrschtml5/rschtml5/testHTML ]]]]]
=> Started proxy.
=> Started MongoDB.
W20141017-13:19:19.659(5.5)? (STDERR)
W20141017-13:19:19.737(5.5)? (STDERR) /home/kanna/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141017-13:19:19.738(5.5)? (STDERR) throw(ex);
W20141017-13:19:19.739(5.5)? (STDERR) ^
W20141017-13:19:19.739(5.5)? (STDERR) TypeError: Cannot call method 'add' of undefined
W20141017-13:19:19.739(5.5)? (STDERR) at app/server/route.js:8:15
W20141017-13:19:19.740(5.5)? (STDERR) at app/server/route.js:930:3
W20141017-13:19:19.740(5.5)? (STDERR) at /home/kanna/Desktop/testhtml5/testhtml5/testHTML/.meteor/local/build/programs/server/boot.js:168:10
W20141017-13:19:19.740(5.5)? (STDERR) at Array.forEach (native)
W20141017-13:19:19.741(5.5)? (STDERR) at Function..each..forEach (/home/kanna/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141017-13:19:19.741(5.5)? (STDERR) at /home/kanna/Desktop/rschtml5/rschtml5/testhtml5/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
The code for route.js is
Meteor.Router.add({
'/output/login': function () {
/some thing here
}
I need to connect a Local MongoDB to Meteor. I did a "LeaderBoard" example in which I tried to connect to Local DB by using the below procedure:
meteor mongo lboard.meteor.com //Deploy project name is lboard.meteor.com
MongoDB shell version: 2.4.8
connecting to: production-db-b3.meteor.io:27017/lboard_meteor_com
then i try to switch DB using the below procedure:
> use lboard_meteor_com
//This time i got the below error
switched to db lboard_meteor_com
Thu Jan 23 15:09:42.125 trying reconnect to production-db-b3.meteor.io:27017
Thu Jan 23 15:09:48.127 reconnect production-db-b3.meteor.io:27017 failed couldn
't connect to server production-db-b3.meteor.io:27017
Also, I get an error in the server console as shown below and I am new to meteor so please have a look at the below and above error and tell me what to do.
Server Console Error Log & What i am did in server is:
C:\Users\***>e:
E:\>cd ***/meteor/db
E:\***\Meteor\DB>set MONGO_URL=mongodb://localhost:27017/ddhcare_meteor_co
m
E:\**\Meteor\DB>meteor
[[[[[ E:\***\Meteor\DB ]]]]]
=> Meteor server running on: http://localhost:3000/
W20140124-13:32:29.831(5.5)? (STDERR) C:\Users\***\AppData\Local\.meteor\packag
es\mongo-livedata\31700cb194\npm\node_modules\mongodb\lib\mongodb\mongo_client.j
s:359
W20140124-13:32:29.922(5.5)? (STDERR) throw err
W20140124-13:32:29.922(5.5)? (STDERR) ^
W20140124-13:32:29.924(5.5)? (STDERR) Error: failed to connect to [localhost:270
17]
W20140124-13:32:29.925(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\server.js:540:74)
W20140124-13:32:29.925(5.5)? (STDERR) at EventEmitter.emit (events.js:106:17
)
W20140124-13:32:29.926(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\connection_pool.js:140:15)
W20140124-13:32:29.926(5.5)? (STDERR) at EventEmitter.emit (events.js:98:17)
W20140124-13:32:29.927(5.5)? (STDERR) at Socket.<anonymous> (C:\Users\Hari\A
ppData\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb
\lib\mongodb\connection\connection.js:478:10)
W20140124-13:32:29.927(5.5)? (STDERR) at Socket.EventEmitter.emit (events.js
:95:17)
W20140124-13:32:29.928(5.5)? (STDERR) at net.js:441:14
W20140124-13:32:29.928(5.5)? (STDERR) at process._tickCallback (node.js:415:
13)
=> Exited with code: 8
=> Meteor server restarted
W20140124-13:32:32.697(5.5)? (STDERR) C:\Users\Hari\AppData\Local\.meteor\packag
es\mongo-livedata\31700cb194\npm\node_modules\mongodb\lib\mongodb\mongo_client.j
s:359
W20140124-13:32:32.698(5.5)? (STDERR) throw err
W20140124-13:32:32.699(5.5)? (STDERR) ^
W20140124-13:32:32.700(5.5)? (STDERR) Error: failed to connect to [localhost:270
17]
W20140124-13:32:32.701(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\server.js:540:74)
W20140124-13:32:32.701(5.5)? (STDERR) at EventEmitter.emit (events.js:106:17
)
W20140124-13:32:32.702(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\connection_pool.js:140:15)
W20140124-13:32:32.703(5.5)? (STDERR) at EventEmitter.emit (events.js:98:17)
W20140124-13:32:32.703(5.5)? (STDERR) at Socket.<anonymous> (C:\Users\Hari\A
ppData\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb
\lib\mongodb\connection\connection.js:478:10)
W20140124-13:32:32.704(5.5)? (STDERR) at Socket.EventEmitter.emit (events.js
:95:17)
W20140124-13:32:32.705(5.5)? (STDERR) at net.js:441:14
W20140124-13:32:32.706(5.5)? (STDERR) at process._tickCallback (node.js:415:
13)
=> Exited with code: 8
=> Meteor server restarted
W20140124-13:32:35.495(5.5)? (STDERR) C:\Users\Hari\AppData\Local\.meteor\packag
es\mongo-livedata\31700cb194\npm\node_modules\mongodb\lib\mongodb\mongo_client.j
s:359
W20140124-13:32:35.497(5.5)? (STDERR) throw err
W20140124-13:32:35.498(5.5)? (STDERR) ^
W20140124-13:32:35.501(5.5)? (STDERR) Error: failed to connect to [localhost:270
17]
W20140124-13:32:35.505(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\server.js:540:74)
W20140124-13:32:35.509(5.5)? (STDERR) at EventEmitter.emit (events.js:106:17
)
W20140124-13:32:35.513(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\connection_pool.js:140:15)
W20140124-13:32:35.517(5.5)? (STDERR) at EventEmitter.emit (events.js:98:17)
W20140124-13:32:35.521(5.5)? (STDERR) at Socket.<anonymous> (C:\Users\Hari\A
ppData\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb
\lib\mongodb\connection\connection.js:478:10)
W20140124-13:32:35.526(5.5)? (STDERR) at Socket.EventEmitter.emit (events.js
:95:17)
W20140124-13:32:35.529(5.5)? (STDERR) at net.js:441:14
W20140124-13:32:35.532(5.5)? (STDERR) at process._tickCallback (node.js:415:
13)
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
If you want to use a local MongoDB instance you should instead set the MONGO_URL environment variable before starting meteor:
export MONGO_URL=mongodb://localhost:27017/dbname
meteor
To connect to the local MongoDB instance, you should also use the mongo shell rather than meteor mongo:
$ mongo dbname
MongoDB shell version: 2.4.9
connecting to: test
>