def sendemailnotification (userid, shortcontent, content): if userid in unsubscribe_list: return emaillogging = UserEmail(userid=userid, fofid=0, action=9999) emaillogging.save() s = sendgrid.Sendgrid('pratikpoddar', 'P1jaidadiki', secure=True) userinfo = UserTomonotomo.objects.get(userid=userid) contextdict = {} subject = userinfo.first_name + ", " + shortcontent contextdict['teaserline'] = subject contextdict['mailheading'] = subject contextdict['mailcontent'] = "Hey "+userinfo.first_name+", Hope you are doing well. " + content + " Regards, Tomonotomo" plaintext_message = contextdict['mailcontent'] html_message = prepareEmailNotification(contextdict) message = sendgrid.Message(("*****@*****.**","Tomonotomo"), subject, plaintext_message, html_message) # add a recipient message.add_to(userinfo.email, userinfo.get_full_name()) # use the SMTP API to send your message s.smtp.send(message) #message.add_to('*****@*****.**', 'Pratik Poddar') #s.smtp.send(message) return
def sendemailFoF (userid, fofid): emaillogging = UserEmail(userid=userid, fofid=fofid, action=2) emaillogging.save() s = sendgrid.Sendgrid('pratikpoddar', 'P1jaidadiki', secure=True) userinfo = UserTomonotomo.objects.get(userid=userid) fofinfo = UserTomonotomo.objects.get(userid=fofid) contextdict = {} subject = "Connection Request by " + userinfo.first_name + " to connect with " + fofinfo.first_name contextdict['teaserline'] = subject contextdict['mailheading'] = subject contextdict['mailcontent'] = "Hey "+fofinfo.first_name+", Hope you are doing well. I discovered you on www.tomonotomo.com . I think we might hit it off together. I would like to connect with you. To feel comfortable before replying to the email, you can assure yourself through our mutual friends. You can get all the details from my tomonotomo profile page. Thanks a ton. Sincere apologies if I was offensive or intrusive in any way. Regards, "+userinfo.first_name plaintext_message = contextdict['mailcontent'] html_message = prepareEmail(contextdict, userid, fofid, userinfo.get_full_name(), fofinfo.get_full_name()) message = sendgrid.Message(("*****@*****.**","Tomonotomo"), subject, plaintext_message, html_message) # add a recipient message.add_to(userinfo.email, userinfo.get_full_name()) message.add_to(fofinfo.email, fofinfo.get_full_name()) # use the SMTP API to send your message s.smtp.send(message) #message.add_to('*****@*****.**', 'Pratik Poddar') #s.smtp.send(message) return
def sendemailCute (userid, fofid): emaillogging = UserEmail(userid=userid, fofid=fofid, action=3) emaillogging.save() s = sendgrid.Sendgrid('pratikpoddar', 'P1jaidadiki', secure=True) userinfo = UserTomonotomo.objects.get(userid=userid) fofinfo = UserTomonotomo.objects.get(userid=fofid) contextdict = {} subject = "Mutual Connection Request for " + userinfo.first_name + " and " + fofinfo.first_name contextdict['teaserline'] = subject contextdict['mailheading'] = subject contextdict['mailcontent'] = "Hey "+fofinfo.first_name+" and "+userinfo.first_name+", Both of you have indicated privately that you admire each other. Since both of you want to meet each other, by god's grace, we at tomonotomo, have been privileged, to introduce you to each other. You can take it forward from here. Best of Luck. We are happy. :-). Thanks a ton. Regards, Tomonotomo." plaintext_message = contextdict['mailcontent'] html_message = prepareEmail(contextdict, userid, fofid, userinfo.get_full_name(), fofinfo.get_full_name()) message = sendgrid.Message(("*****@*****.**","Tomonotomo"), subject, plaintext_message, html_message) # add a recipient message.add_to(userinfo.email, userinfo.get_full_name()) message.add_to(fofinfo.email, fofinfo.get_full_name()) # use the SMTP API to send your message s.smtp.send(message) #message.add_to('*****@*****.**', 'Pratik Poddar') #s.smtp.send(message) return
def sendemailFriend (userid, fofid, friendid): emaillogging = UserEmail(userid=userid, fofid=fofid, friendid=friendid, action=1) emaillogging.save() s = sendgrid.Sendgrid('pratikpoddar', 'P1jaidadiki', secure=True) userinfo = UserTomonotomo.objects.get(userid=userid) fofinfo = UserTomonotomo.objects.get(userid=fofid) friendinfo = UserTomonotomo.objects.get(userid=friendid) contextdict = {} subject = "Request by " + userinfo.first_name + " to get connected with " + fofinfo.first_name contextdict['teaserline'] = subject contextdict['mailheading'] = subject contextdict['mailcontent'] = "Hey "+friendinfo.first_name+", Hope you are doing well. I discovered "+fofinfo.first_name+" on www.tomonotomo.com . I think we might hit it off together. Do you mind introducing me to " + fofinfo.first_name + " and I will take it forward from there. Thanks a ton. Regards, "+userinfo.first_name plaintext_message = contextdict['mailcontent'] html_message = prepareEmail(contextdict, userid, fofid, userinfo.get_full_name(), fofinfo.get_full_name()) message = sendgrid.Message(("*****@*****.**","Tomonotomo"), subject, plaintext_message, html_message) # add a recipient message.add_to(userinfo.email, userinfo.get_full_name()) message.add_to(friendinfo.email, friendinfo.get_full_name()) # use the SMTP API to send your message s.smtp.send(message) #message.add_to('*****@*****.**', 'Pratik Poddar') #s.smtp.send(message) return
def sendPromotionalEmailCuteFriends101(userid): # Being saved in email logging as action item 101 l = top_admires(userid) if len(l) < 2: return if min(l[0].values()[0], l[1].values()[0]) < 2: return s = sendgrid.Sendgrid('pratikpoddar', 'P1jaidadiki', secure=True) userinfo = UserTomonotomo.objects.get(userid=userid) friend1info = UserTomonotomo.objects.get(userid=l[0].keys()[0]) friend2info = UserTomonotomo.objects.get(userid=l[1].keys()[0]) contextdict = {} subject = userinfo.first_name + ", your friends find " + friend1info.first_name + " and " + friend2info.first_name + " attractive" contextdict['teaserline'] = subject contextdict['mailheading'] = subject contextdict['mailcontent'] = "Hey "+userinfo.first_name+", Hope you are doing well. Your friends find " + friend1info.first_name + " and " + friend2info.first_name + " attractive. They are trending in your friend network on tomonotomo. You can also secretly indicate that you admire some friend of friend. If he/she also feels the same way, you two would be connected. Best of Luck!" plaintext_message = contextdict['mailcontent'] html_message = dbutils.prepareEmail(contextdict, l[0].keys()[0], l[1].keys()[0], friend1info.get_full_name(), friend2info.get_full_name()) message = sendgrid.Message(("*****@*****.**","Tomonotomo"), subject, plaintext_message, html_message) # add a recipient message.add_to(userinfo.email, userinfo.get_full_name()) # use the SMTP API to send your message s.smtp.send(message) #message.add_to('*****@*****.**', 'Pratik Poddar') #s.smtp.send(message) emaillogging = UserEmail(userid=userid, fofid=l[0].keys()[0], friendid=l[1].keys()[0], action=101) emaillogging.save() return