• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

TypeScript email.Email类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中meteor/email.Email的典型用法代码示例。如果您正苦于以下问题:TypeScript Email类的具体用法?TypeScript Email怎么用?TypeScript Email使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Email类的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: '[email protected]',
          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`
        });
      }
    }
  },
开发者ID:harishmaiya,项目名称:gundmi48-gadikatte58,代码行数:33,代码来源:tracks.methods.ts


示例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: '[email protected]',
          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`
        });
      }
    }
  },
开发者ID:ElijahWolfe,项目名称:socially,代码行数:33,代码来源:methods.ts


示例3: 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 = "[email protected]";
      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);
      }
  },
开发者ID:p3140,项目名称:angular2-meteor-starter-kit,代码行数:55,代码来源:methods.ts


示例4: function

  mail: function(text: string) {
    check(text, String);

    this.unblock();

    Email.send({
	from: "[email protected]",
	to: "[email protected]",
	subject: "[email protected]",
	text: text
    });
  },
开发者ID:ddjohn,项目名称:bodhi,代码行数:12,代码来源:methods.ts


示例5: 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,
         });
       }
     }
   }
 }
开发者ID:gab3alm,项目名称:csun_nsls,代码行数:17,代码来源:snt.methods.ts


示例6: 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: '[email protected]',
        subject: `PARTY: ${party.title}`,
        text: `
          Hey, I just invited you to ${party.title} on Socially.
          Come check it out: ${Meteor.absoluteUrl()}
        `
      });
    }
  }
}
开发者ID:AyushAnandChouksey,项目名称:meteor-angular-socially,代码行数:46,代码来源:methods.ts


示例7:

			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
				});
			});
开发者ID:djulls07,项目名称:projects-manager,代码行数:9,代码来源:tasks.ts


示例8: 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."
  });
}
开发者ID:gab3alm,项目名称:csun_nsls,代码行数:9,代码来源:snt.methods.ts


示例9: 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
      });    
    }
  }
}
开发者ID:gab3alm,项目名称:csun_nsls,代码行数:16,代码来源:snt.methods.ts


示例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 };
	},
开发者ID:djulls07,项目名称:projects-manager,代码行数:62,代码来源:projects.ts



注:本文中的meteor/email.Email类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript http.HTTP类代码示例发布时间:2022-05-25
下一篇:
TypeScript check.Match类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap