當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript email.Email類代碼示例

本文整理匯總了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: '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`
        });
      }
    }
  },
開發者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: '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`
        });
      }
    }
  },
開發者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 = "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);
      }
  },
開發者ID:p3140,項目名稱:angular2-meteor-starter-kit,代碼行數:55,代碼來源:methods.ts

示例4: 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
    });
  },
開發者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: 'noreply@socially.com',
        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;未經允許,請勿轉載。