def externalSender(rcvrs): sender = "Socialray Team <*****@*****.**>" rcvr = rcvrs[0] receivers = ['"' + rcvr.name + '" <' + rcvr.email + '>'] ext_html_message = replaceParams(template_html, parameters, rcvr) ext_text_message = replaceParams(template_text, parameters, rcvr) mailman.sendOneWayMail(sender, receivers, subject, ext_html_message, None, None, ext_text_message)
def sendLaunchMail(user): mail_subject = 'Announcing the launch of socialray.org!' mail_body_html = '<p>Hello ' + user.name + ',</p><p>We are proud to announce the launch of socialray.org. ' + \ 'Starting today, socialray.org is accessible worldwide.We express our sincere gratitude to all our users, ' + \ 'for sending us dozens of bug reports and even more suggestions. And for all the encouragement, ' + \ 'and the disapprovals which were equally valuable.</p>' + \ '<p>Without you, it would have been impossible to get here. Thank you.</p>' + \ '<p>In the last three months while you were part of Socialray, we were hard at work on the continuous ' + \ 'feedback you were giving us. And we also added some great features. Like the new chat system, and better ' + \ 'privacy protection. But this is just the beginning. Many more features that we would love to show you ' + \ 'are coming up next month, when we roll out our next release.</p>' + \ '<p>Last week we decided to make an important transition. ' + \ 'We decided not to have different websites for each country. Instead there will just be one socialray.org.</p>' + \ '<p>One planet. No boundaries. One great network.</p>' + \ '<p>So have a good day, enjoy the evening, or good night. We don\'t know, because socialray.org ' + \ 'is now available worldwide!</p><p>Cheers,<br />The Socialray Team</p>' mail_body_text = 'Hello ' + user.name + ',\r\nWe are proud to announce the launch of socialray.org. ' + \ 'Starting today, socialray.org is accessible worldwide.We express our sincere gratitude to all our users, ' + \ 'for sending us dozens of bug reports and even more suggestions. And for all the encouragement, ' + \ 'and the disapprovals which were equally valuable.\r\n' + \ 'Without you, it would have been impossible to get here. Thank you.\r\n' + \ 'In the last three months while you were part of Socialray, we were hard at work on the continuous ' + \ 'feedback you were giving us. And we also added some great features. Like the new chat system, and better ' + \ 'privacy protection. But this is just the beginning. Many more features that we would love to show you ' + \ 'are coming up next month, when we roll out our next release.\r\n' + \ 'Last week we decided to make an important transition. ' + \ 'We decided not to have different websites for each country. Instead there will just be one socialray.org.\r\n' + \ 'One planet. No boundaries. One great network.\r\n' + \ 'So have a good day, enjoy the evening, or good night. We don\'t know, because socialray.org ' + \ 'is now available worldwide!\r\n\r\nCheers,\r\nThe Socialray Team\r\n' mailman.sendOneWayMail('Socialray<*****@*****.**', ['"' + user.name + '" <' + user.email + '>'], mail_subject, mail_body_html, None, None, mail_body_text)
def handle(request): if request.method == 'GET': return siteaction.render_to_response('forgotpassword.htm') elif request.method == 'POST': accounts = models.Account.objects.filter(username=dataplus.dictGetVal(request.REQUEST,'username')) if (accounts.count() > 0): target_acct = accounts[0] uniqueId = dataplus.getUniqueId() password_change_req = models.PasswordChangeRequest() password_change_req.account = target_acct password_change_req.req_random_key = uniqueId password_change_req.created_at = datetime.datetime.utcnow() password_change_req.save() #Send recovery email... mail_subject = 'Reset your Socialray password' mail_body = '<p>Hello,</p>' mail_body += '<p>You received this email because a Password Reset was requested for your Socialray account. <br />' mail_body += 'Just click the link <a href="' + config.server_base_url + '/resetpassword.htm?' + \ 'passwordChangeKey=' + uniqueId + '"><strong>Reset My Password</strong></a> to change your password.</p>' mail_body += '<p>If you did not request it, you can safely ignore this mail.</p>' mail_body += '<p>Regards,<br />from Socialray</p>' mailman.sendOneWayMail(config.system_email, [target_acct.email], mail_subject, mail_body) return siteaction.render_to_response('showmessage.htm', {'msg_heading': 'Password Reset', 'msg_html': 'A link to recover your password was sent to your email address. ' + \ 'The link will expire in 24 hours. <a href="' + config.server_base_url + '">Back to Homepage</a>.'}) else: return siteaction.render_to_response('forgotpassword.htm', {'error_html': '<p style="color:#FF0000">The username does not exist.</p>'})
def inviteToChatByEmail(request, session_id): try: chat_id = dataplus.dictGetVal(request.REQUEST, 'chatId', '') if not chat_id: return ajaxian.getFailureResp('error:invalid_chatId') username = dataplus.dictGetVal(request.REQUEST, 'username', '') name = dataplus.dictGetVal(request.REQUEST, 'name', '') invited_name = dataplus.dictGetVal(request.REQUEST, 'invitedName', '', lambda x: x.strip()) invited_email = dataplus.dictGetVal(request.REQUEST, 'invitedEmail', '', lambda x: x.strip()) text = dataplus.dictGetSafeVal(request.REQUEST, 'text', '') subject = 'Chat Invitation to Socialray' sender = name + '<' + username + '*****@*****.**>' html_message = '<p>Hello ' + invited_name + '</p><p>' + name + ' wants to have a chat with you and has sent you the following message ' + \ 'inviting you to a chat session in Socialray.</p><p>"' + text + '"</p>' + \ '<p>You can <a href="' + config.server_base_url + '/chat/startchat.htm?chatId=' + chat_id + '">join ' + name + '</a> in chat now.</p>' + \ '<p>Regards,<br />from Socialray</p>' text_message = 'Hello ' + invited_name + '\r\n' + name + ' wants to have a chat with you and has sent you the following message ' + \ 'inviting you to a chat session in Socialray.\r\n"' + text + '"\r\n' + \ 'Please visit ' + config.server_base_url + '/chat/startchat.htm?chatId=' + chat_id + ' to join ' + name + ' in chat now.\r\n' + \ 'regards,\r\nfrom Socialray\r\n\r\n' mailman.sendOneWayMail(sender, [invited_name + '<' + invited_email + '>'], subject, html_message, None, None, text_message) livewire_client.command('inviteByEmail', [session_id, chat_id, invited_name, invited_email]) return ajaxian.getSuccessResp('') except: return ajaxian.getFailureResp('error:unknown')
def externalSender(rcvr_accounts): receivers = ['"' + rcvr.name + '" <' + rcvr.email + '>' for rcvr in rcvr_accounts] ext_html_message = html_message + \ '<br /><br /><br /><br /><br />' + \ 'If you don\'t want to receive notification emails, change your Account Settings ' + \ '<a href="' + config.server_base_url + '/me/editsettings.htm">here</a>' ext_text_message = text_message + \ '\r\n\r\n\r\n\r\n\r\n' + \ 'If you don\'t want to receive notification emails, change your Account Settings here\r\n' + \ config.server_base_url + '/me/editsettings.htm' mailman.sendOneWayMail(config.system_email, receivers, subject, ext_html_message, None, None, ext_text_message)
def externalSender(rcvr_accounts): sender = '"' + myself.name + '" <' + myself.username + '*****@*****.**>' receivers = ['"' + rcvr.name + '" <' + rcvr.email + '>' for rcvr in rcvr_accounts] mailman.sendOneWayMail(sender, receivers, subject, html_message, None, None, text_message)
def createUser(username, name, password, email, country, industry_category='Software/IT', experience=0, invitation=None): username = username.lower() #add some transactions here? account = models.Account() account.username = username account.name = name account.password = dataplus.hash(password) account.email = email account.account_type = 'U' account.account_state = 'A' account.save() user = models.User() user.account = account user.username = username user.name = name user.email = email user.last_access_time = datetime.datetime.utcnow() user.last_update_time = datetime.datetime.utcnow() user.resume_update_time = config.min_date #some defaults for the images user.image_file_path = config.noimg user.image_size1_file_path = config.noimg_50 user.image_size2_file_path = config.noimg_72 user.image_size3_file_path = config.noimg_128 resume_contents = models.ResumeContents() resume_contents.text = 'Resume not uploaded yet.' resume_contents.masked_text = 'Resume not uploaded yet.' resume_contents.html_style = '' resume_contents.html_formatter = '' resume_contents.save() user.resume_contents = resume_contents #Empty vessels make more noise user.phone = '' user.personal_desc = '' user.small_desc = '' user.blog_url = '' user.hilite = '' user.resume_dir = '' user.salary_range_lower = 0 user.salary_range_upper = 0 user.working_since = datetime.datetime.utcnow() - datetime.timedelta(experience * 365) user.industry_category = models.IndustryCategory.objects.get(name=industry_category) #save maadi! user.save() user_settings = models.UserSettings() user_settings.email_fwd_messages = False user_settings.email_fwd_jobrefs = True user_settings.email_fwd_alerts = True user_settings.phone_num_visibility = 'friends' user_settings.resume_visibility = 'everyone' user_settings.interest_in_new_job = 'active' user_settings.preferred_location = 'Anywhere' user_settings.original_resume_format = '' user_settings.available_resume_download_formats = '' user_settings.preferred_resume_download_format = 'pdf' user_settings.resume_download_format_set = False user_settings.enable_voip_dial = True user_settings.country = country user_settings.currency = statix.country_currency_map[user_settings.country] user_settings.user = user user_settings.save() chat_settings = models.ChatSettings() chat_settings.account = account chat_settings.online_status = 'everyone' chat_settings.custom_message = '' chat_settings.invite_preference = 'friends' chat_settings.ignore_list = '' chat_settings.image_size1_file_path = config.noimg_50 chat_settings.image_size2_file_path = config.noimg_72 chat_settings.image_size3_file_path = config.noimg_128 chat_settings.save() matching_jobs = models.MatchingJobs() matching_jobs.user = user matching_jobs.jobs = '' matching_jobs.save() mru_data = models.UserMRUData() mru_data.last_accessed_time = datetime.datetime.utcnow() mru_data.user = user mru_data.save() mail1_subject = 'Let\'s get started with Socialray' mail1_body_html = '<p>Welcome to Socialray.</p><p>Some of the things you can try out on Socialray:<br />' + \ ' - Making your Resume searchable through Google<br />' + \ ' - <a href="/me/searchpeople.htm">Find friends</a> and other connections<br />' + \ ' - Join <a href="/me/searchcommunities.htm">Interesting Communities</a><br />' + \ ' - Add credibility to your resume with <a href="/profiles/' + user.username + '/">Testimonials</a><br />' + \ ' - Refer jobs to your Friends and Communities<br />' + \ ' - Chat with your friends using Socialray Web Chat<br />' + \ ' - You can even <a href="/me/editmedia.htm">attach videos</a> to your resume</p>' + \ '<p>Socialray is learning. And we are evolving with new features. So keep checking.</p>' + \ '<p>Regards,<br />Socialray Team</p>' mail1_body_text = 'Welcome to Socialray. \r\n\r\n Some of the things you can try out on Socialray:\r\n' + \ ' - Making your Resume searchable through Google\r\n' + \ ' - Find friends and other connections\r\n' + \ ' - Join Interesting Communities\r\n' + \ ' - Add credibility to your resume with Testimonials\r\n' + \ ' - Refer jobs to your Friends and Communities\r\n' + \ ' - Chat with your friends using Socialray Web Chat\r\n' + \ ' - You can even attach videos to your resume\r\n\r\n' + \ 'Socialray is learning. And we are evolving with new features. So keep checking.\r\n\r\n' + \ 'Regards,\r\nSocialray Team\r\n\r\n' mail1_body_html_external = '<p>Welcome to Socialray.</p><p>Some of the things you can try out on Socialray:<br />' + \ ' - Making your Resume searchable through Google<br />' + \ ' - <a href="http://www.socialray.org/me/searchpeople.htm">Find friends</a> and other connections<br />' + \ ' - Join <a href="http://www.socialray.org/me/searchcommunities.htm">Interesting Communities</a><br />' + \ ' - Add credibility to your resume with <a href="http://www.socialray.org/profiles/' + user.username + '/">Testimonials</a><br />' + \ ' - Refer Jobs to your Friends and Communities<br />' + \ ' - Chat with your friends using Socialray Web Chat<br />' + \ ' - You can even <a href="http://www.socialray.org/me/editmedia.htm">Attach Videos</a> to your resume</p>' + \ '<p>Socialray is learning. And we are evolving with new features. So keep checking.</p>' + \ '<p>Regards,<br />Socialray Team</p>' mailman.sendToInbox(None, user.username, mail1_subject, mail1_body_html, 'SA') mailman.sendOneWayMail('Socialray ' + config.system_email, ['"' + user.name + '" <' + user.email + '>'], mail1_subject, mail1_body_html_external, None, None, mail1_body_text) mail2_subject = 'Take a tour' mail2_body_html = '<p>Socialray has added some really exciting features, like the new chat system, yahoo and skype integration and better communities.</p>' + \ '<p>We have created the <a href="/tour.html">socialray tour</a>, to show you all that.</p>' + \ '<p>Regards,<br />Socialray Team</p>' mail2_body_text = 'Socialray has added some really exciting features, like the new chat system, yahoo and skype integration and better communities.\r\n\r\n' + \ 'We have created the socialray tour at http://www.socialray.org/tour.html, to show you all that.\r\n\r\n' + \ 'Regards,\r\nSocialray Team\r\n\r\n' mailman.sendToInbox(None, user.username, mail2_subject, mail2_body_html, 'SA') mailman.sendOneWayMail('Socialray ' + config.system_email, ['"' + user.name + '" <' + user.email + '>'], mail2_subject, mail2_body_html, None, None, mail2_body_text) if invitation: post_signup_actions = models.PostSignupActions(user=user) post_signup_actions.actions = invitation post_signup_actions.save() return user
def externalSender(rcvr_accounts): mailman.sendOneWayMail(config.system_email, [rcvr_accounts[0].email], subject, html_message, None, None, text_message)