Example #1
0
def sendmail(recipients, sender='', msg='', subject='[No Subject]'):
	"""send an html email as multipart with attachments and all"""
	if webnotes.mute_emails:
		return

	from webnotes.utils.email_lib.smtp import get_email
	get_email(recipients, sender, msg, subject).send()
Example #2
0
def sendmail(recipients, sender='', msg='', subject='[No Subject]'):
    """send an html email as multipart with attachments and all"""
    if webnotes.mute_emails or getattr(conf, "mute_emails", False):
        return

    from webnotes.utils.email_lib.smtp import get_email
    get_email(recipients, sender, msg, subject).send()
Example #3
0
def add(email,
        sender,
        subject,
        message,
        text_content=None,
        ref_doctype=None,
        ref_docname=None):
    """add to bulk mail queue"""
    from webnotes.utils.email_lib.smtp import get_email

    e = Document('Bulk Email')
    e.sender = sender
    e.recipient = email
    try:
        e.message = get_email(email,
                              sender=e.sender,
                              msg=message,
                              subject=subject,
                              text_content=text_content).as_string()
    except webnotes.ValidationError:
        # bad email id - don't add to queue
        return

    e.status = 'Not Sent'
    e.ref_doctype = ref_doctype
    e.ref_docname = ref_docname
    e.save()
Example #4
0
def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]', send_me_a_copy=False):
	from json import loads
	footer = None

	if sent_via:
		if hasattr(sent_via, "get_sender"):
			d.sender = sent_via.get_sender(d) or d.sender
		if hasattr(sent_via, "get_subject"):
			d.subject = sent_via.get_subject(d)
		if hasattr(sent_via, "get_content"):
			d.content = sent_via.get_content(d)
			
		footer = set_portal_link(sent_via, d)
		
	from webnotes.utils.email_lib.smtp import get_email
	mail = get_email(d.recipients, sender=d.sender, subject=d.subject, 
		msg=d.content, footer=footer)
	
	if send_me_a_copy:
		mail.cc.append(webnotes.conn.get_value("Profile", webnotes.session.user, "email"))
	
	if print_html:
		mail.add_attachment(name.replace(' ','').replace('/','-') + '.html', print_html)

	for a in loads(attachments):
		try:
			mail.attach_file(a)
		except IOError, e:
			webnotes.msgprint("""Unable to find attachment %s. Please resend without attaching this file.""" % a,
				raise_exception=True)
Example #5
0
def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]', send_me_a_copy=False):
	from json import loads
	
	if sent_via:
		if hasattr(sent_via, "get_sender"):
			d.sender = sent_via.get_sender(d)
		if hasattr(sent_via, "get_subject"):
			d.subject = sent_via.get_subject(d)
		if hasattr(sent_via, "get_content"):
			d.content = sent_via.get_content(d)

	if not d.sender:
		d.sender = webnotes.session.user

	from webnotes.utils.email_lib.smtp import get_email
	mail = get_email(d.recipients, sender=d.sender, subject=d.subject, 
		msg=d.content)
	
	if send_me_a_copy:
		mail.cc.append(d.sender)
	
	if print_html:
		mail.add_attachment(name.replace(' ','').replace('/','-') + '.html', print_html)

	for a in loads(attachments):
		try:
			mail.attach_file(a)
		except IOError, e:
			webnotes.msgprint("""Unable to find attachment %s. Please resend without attaching this file.""" % a,
				raise_exception=True)
Example #6
0
def add(email, sender, subject, message, text_content = None):
	"""add to bulk mail queue"""
	from webnotes.utils.email_lib.smtp import get_email
	
	e = Document('Bulk Email')
	e.sender = sender
	e.recipient = email
	e.message = get_email(email, sender=e.sender, msg=message, subject=subject, 
		text_content = text_content).as_string()
	e.status = 'Not Sent'
	e.save()
Example #7
0
def add(email, sender, subject, message, text_content = None):
	"""add to bulk mail queue"""
	from webnotes.utils.email_lib.smtp import get_email
	
	e = Document('Bulk Email')
	e.sender = sender
	e.recipient = email
	e.message = get_email(email, sender=e.sender, msg=message, subject=subject, 
		text_content = text_content).as_string()
	e.status = 'Not Sent'
	e.save()
Example #8
0
def add(email, sender, subject, message, text_content=None, ref_doctype=None, ref_docname=None):
	"""add to bulk mail queue"""
	from webnotes.utils.email_lib.smtp import get_email
	
	e = Document('Bulk Email')
	e.sender = sender
	e.recipient = email
	try:
		e.message = get_email(email, sender=e.sender, msg=message, subject=subject, 
			text_content = text_content).as_string()
	except webnotes.ValidationError, e:
		# bad email id - don't add to queue
		return
Example #9
0
def sendmail_to_system_managers(subject, content):
    from webnotes.utils.email_lib.smtp import get_email

    get_email(get_system_managers(), None, content, subject).send()
Example #10
0
def sendmail(recipients, sender="", msg="", subject="[No Subject]"):
    """send an html email as multipart with attachments and all"""
    from webnotes.utils.email_lib.smtp import get_email

    get_email(recipients, sender, msg, subject).send()
Example #11
0
def sendmail_to_system_managers(subject, content):
    from webnotes.utils.email_lib.smtp import get_email
    get_email(get_system_managers(), None, content, subject).send()
Example #12
0
def sendmail(recipients, sender='', msg='', subject='[No Subject]'):
    """send an html email as multipart with attachments and all"""
    from webnotes.utils.email_lib.smtp import get_email
    get_email(recipients, sender, msg, subject).send()