本文整理汇总了TypeScript中meteor/email.Email.send方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Email.send方法的具体用法?TypeScript Email.send怎么用?TypeScript Email.send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meteor/email.Email
的用法示例。
在下文中一共展示了Email.send方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
invite: function (trackId:string, userId:string) {
check(trackId, String);
check(userId, String);
let track = Tracks.collection.findOne(trackId);
if (!track)
throw new Meteor.Error('404', 'No such track!');
if (track.public)
throw new Meteor.Error('400', 'That track is public. No need to invite people.');
if (track.owner !== this.userId)
throw new Meteor.Error('403', 'No permissions!');
if (userId !== track.owner && (track.invited || []).indexOf(userId) == -1) {
Tracks.collection.update(trackId, {$addToSet: {invited: userId}});
let from = getContactEmail(Meteor.users.findOne(this.userId));
let to = getContactEmail(Meteor.users.findOne(userId));
if (Meteor.isServer && to) {
Email.send({
from: 'noreply@beetrut.com',
to: to,
replyTo: from || undefined,
subject: 'TRACK: ' + track.name,
text: `Hi, I just invited you to ${track.name} on Beetrut.
\n\nCome check it out: ${Meteor.absoluteUrl()}\n`
});
}
}
},
示例2: function
invite: function (partyId:string, userId:string) {
check(partyId, String);
check(userId, String);
let party = Parties.findOne(partyId);
if (!party)
throw new Meteor.Error('404', 'No such party!');
if (party.public)
throw new Meteor.Error('400', 'That party is public. No need to invite people.');
if (party.owner !== this.userId)
throw new Meteor.Error('403', 'No permissions!');
if (userId !== party.owner && (party.invited || []).indexOf(userId) == -1) {
Parties.update(partyId, {$addToSet: {invited: userId}});
let from = getContactEmail(Meteor.users.findOne(this.userId));
let to = getContactEmail(Meteor.users.findOne(userId));
if (Meteor.isServer && to) {
Email.send({
from: 'noreply@socially.com',
to: to,
replyTo: from || undefined,
subject: 'PARTY: ' + party.name,
text: `Hi, I just invited you to ${party.name} on Socially.
\n\nCome check it out: ${Meteor.absoluteUrl()}\n`
});
}
}
},
示例3:
task.targets.forEach((target) => {
let to = target.email;
Email.send({
to: to,
from: process.env.MAIL_FROM,
subject: 'You have a new task',
text: 'New task ['+task.name+'] on project: '+project.name+', added by ' + task.ownerEmail
});
});
示例4: function
invite: function (user: Invitation) {
// check(partyId, String);
// check(userId, String);
// let party = Parties.findOne(partyId);
// if (!party)
// throw new Meteor.Error('404', 'No such party!');
// if (party.public)
// throw new Meteor.Error('400', 'That party is public. No need to invite people.');
// if (party.owner !== this.userId)
// throw new Meteor.Error('403', 'No permissions!');
// Parties.update(partyId, {$addToSet: {invited: userId}});
let token = Random.hexString( 16 );
let message = {
subject: "Invitation",
text: `Hi, I just invited you to be an user in my brand new app!.
\n\nCome check it out: ${Meteor.absoluteUrl()}acceptinvitation/${token}\n`
};
Invitations.insert({
// company: ['', Validators.required],
company: user.company,
name: user.name,
last_name: user.last_name,
email: user.email,
role: user.role,
phone: user.phone,
address: user.address,
city: user.city,
state: user.state,
postal_code: user.postal_code,
token: token,
invitation_date: user.invitation_date,
message: message,
invited_by: Meteor.userId
});
let _from = "your@e.mail";
let to = user.email;
// console.log(to, Meteor.isServer, user, token);
if (Meteor.isServer && to) {
Email.send({
from: _from,
to: to,
replyTo: _from || undefined,
subject: message.subject,
text: message.text
});
// console.log(token);
}
},
示例5: function
mail: function(text: string) {
check(text, String);
this.unblock();
Email.send({
from: "ddjohn@gmail.com",
to: "ddjohn@gmail.com",
subject: "ddjohn@gmail.com",
text: text
});
},
示例6: newSntMemberNotification
// send email to entire team when new member joins their SNT group.
function newSntMemberNotification(group_id:string, member:snt_member, email_subject:string){
// get members of the group
var members = SNTgroups.find({'_id':group_id}).fetch()[0].members;
for(var i =0; i < members.length; i++){
// send email to member that is not the current addition to the group
if(members[i].auth_Code != member.auth_Code){
Email.send({
to:members[i].email,
from:'csun-nsls',
subject:email_subject,
text: "Name: " + member.firstname + " " + member.lastname + " has joined your Success Networking Team, please contact your new member at their email address " + member.email
});
}
}
}
示例7: function
sendGroupMessageEmail: function(auth_code:string, members:snt_member[], message:string){
// Check if auth_code is legit
for(var i =0 ; i < members.length; i++){
// If code is legit, then we start sending messages to everyone's emails
if(members[i].auth_Code == auth_code){
for(var j = 0; j < members.length; j++){
this.unblock();
Email.send({
to: members[j].email,
from: members[i].firstname + " " + members[i].lastname,
subject: 'SNT Group Message',
text: message + " SENT BY - " + members[i].firstname + " " + members[i].lastname,
});
}
}
}
}
示例8: invite
export function invite(partyId, userId) {
check(partyId, String);
check(userId, String);
if (!this.userId) {
throw new Meteor.Error(400, 'You have to be logged in!');
}
const party = Parties.findOne(partyId);
if (!party) {
throw new Meteor.Error(404, 'No such party!');
}
if (party.owner !== this.userId) {
throw new Meteor.Error(404, 'No permissions!');
}
if (party.public) {
throw new Meteor.Error(400, 'That party is public. No need to invite people.');
}
if (userId !== party.owner && ! _.contains(party.invited, userId)) {
Parties.update(partyId, {
$addToSet: {
invited: userId
}
});
const replyTo = getContactEmail(Meteor.users.findOne(this.userId));
const to = getContactEmail(Meteor.users.findOne(userId));
if (Meteor.isServer && to) {
Email.send({
to,
replyTo,
from: 'noreply@socially.com',
subject: `PARTY: ${party.title}`,
text: `
Hey, I just invited you to ${party.title} on Socially.
Come check it out: ${Meteor.absoluteUrl()}
`
});
}
}
}
示例9: sendAuthCodeNotification
// send email containing Auth Code to new member
function sendAuthCodeNotification(member:snt_member){
Email.send({
to:member.email,
from:'csun-nsls',
subject:"Success Networking Team Auth Code",
text: "Hello " + member.firstname + ", We are so happy to see that you have joined/created a Success Networking Team. Here is your Auth Code, " + member.auth_Code + ". With this code, you will be able to send emails to your entire SNT group within the csun-nsls website, please keep in mind that this code will also allow you to remove your information from this SNT group if at some point you decide to leave. We hope you have a wonderful time in your SNT group."
});
}
示例10: function
addUserProject: function(projectId: string, userEmail: string) {
let hasCreateUser = false;
if (Meteor.isServer) {
check(userEmail, String);
check(projectId, String);
let project = Projects.findOne(projectId);
let user = Meteor.user();
let pass = Random.id(8);
if (!user || !project) {
throw new Meteor.Error('403', 'not-authorized');
}
if (user._id !== project.owner) {
throw new Meteor.Error('403', 'not-authorized');
}
let userAdd = Meteor.users.findOne({ 'emails.0.address': userEmail });
if (!userAdd) {
let userId = Accounts.createUser({ email: userEmail, password: pass });
userAdd = Meteor.users.findOne(userId);
if (!userAdd) {
throw new Meteor.Error('404', 'user-not-found');
}
hasCreateUser = true;
}
let isIn = false;
project.users.forEach((userP) => {
if (userP.userId === userAdd._id) {
isIn = true;
}
});
if (!isIn) {
Projects.update(projectId, {
$push: {
users: {
email: userEmail,
userId: userAdd._id
}
}
});
}
this.unblock();
if (Meteor.isServer && hasCreateUser) {
// send email with password of account created.
// send the pass to the creator email ( not the invited user ( avoid spam ))
let to = user.emails[0].address
Email.send({
to: to,
from: process.env.MAIL_FROM,
subject: 'New user account created & invited',
text:
'You have invited a new user: "'+userEmail+'", his account has been created for you.\n'+
'Please give the your new collaborator his credentials: \n\n'+
'Login: ' + userEmail+'\n'+
'Password: ' + pass
});
}
}
return { hasCreateUser: hasCreateUser };
},