def enviar(environ, response): from utils.email import send_mail dados = json.loads(environ['wsgi.input'].read().decode()) send_mail('*****@*****.**' % dados['usuario'], dados['senha'], '*****@*****.**', '*****@*****.**' % dados['usuario'], 'etiquetas', '{0}-{1} telefone:{2}\n\n{3};{4};{5};{6};\n\nenviado pelo etiqueta.py'.format( dados['cnpj'], dados['empresa'], dados['telefone'], dados['produto'], dados['notafiscal'], dados['ctrlini'], dados['ctrlfim'])) response('200 OK', [('Content-type', 'text/plain; charset=latin1')]) return ['produto:{0} nota fiscal:{1} controle:{2} a {3}'.format(dados['empresa'], dados['notafiscal'], dados['ctrlini'], dados['ctrlfim'])]
def send_ticket_working(ticket): """Sends an email to the user when a ticket is marked as working""" email_list = [ticket.user.email] send_mail( subject= 'UES Virtual - Plataforma Diagnóstico - Ticket de soporte #{} (resolviendo)' .format(ticket.id), template='email/ticket_working.html', ctx={'ticket': ticket}, recipient_list=email_list, fail_silently=True)
def send_new_ticket_posted(ticket): """Sends an email when a new ticket is posted""" email_list = get_staff_emails() email_list.append(ticket.user.email) send_mail( subject= 'UES Virtual - Plataforma Diagnóstico - Ticket de soporte #{} (abierto)' .format(ticket.id), template='email/new_ticket_posted.html', ctx={'ticket': ticket}, recipient_list=email_list, fail_silently=True)
def send_email_results(result, user): """Send an email with the results""" email_list = [user.email] send_mail( subject= 'UES Virtual - Plataforma Diagnóstico - Reporte de resultados #{}'. format(result.id), template='email/exam_results_email.html', ctx={ 'result': result, 'user': user }, recipient_list=email_list, fail_silently=True)
def send_new_admin_comment_posted(ticket, comment): """Sends an email to the user when a new staff comment is made""" email_list = [ticket.user.email] send_mail( subject= 'UES Virtual - Plataforma Diagnóstico - Ticket de soporte #{} (respuesta nueva)' .format(ticket.id), template='email/new_admin_comment_posted.html', ctx={ 'ticket': ticket, 'comment': comment }, recipient_list=email_list, fail_silently=True)
def send_mail_task(subject,to,body=None,html=None): send_mail(subject,to,body,html)