def send_autoreply(sender, mailbox, armessage): if armessage.fromdate > timezone.now(): return if armessage.untildate is not None \ and armessage.untildate < timezone.now(): armessage.enabled = False armessage.save() return try: lastar = ARhistoric.objects.get(armessage=armessage.id, sender=sender) PostfixAutoreply().load() timeout = parameters.get_admin("AUTOREPLIES_TIMEOUT", app="postfix_autoreply") delta = datetime.timedelta(seconds=int(timeout)) now = timezone.make_aware(datetime.datetime.now(), timezone.get_default_timezone()) if lastar.last_sent + delta > now: sys.exit(0) except ARhistoric.DoesNotExist: lastar = ARhistoric() lastar.armessage = armessage lastar.sender = sender sendmail_simple(mailbox.user.encoded_address, sender, armessage.subject, armessage.content.encode('utf-8')) lastar.last_sent = datetime.datetime.now() lastar.save()
def send_spam(request): status, error = sendmail_simple( "*****@*****.**", request.user.username, content=""" This is the GTUBE, the Generic Test for Unsolicited Bulk Email If your spam filter supports it, the GTUBE provides a test by which you can verify that the filter is installed correctly and is detecting incoming spam. You can send yourself a test mail containing the following string of characters (in upper case and with no white spaces and line breaks): XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X You should send this test mail from an account outside of your network. """, ) if status: return render_to_json_response(_("Message sent")) return render_to_json_response(respmsg=error, status=500)
def send_pr_notification(self, rcpt, reqs): if self.options["verbose"]: print "Sending notification to %s" % rcpt total = reqs.count() reqs = reqs.all()[:10] content = render_to_string( "amavis/notifications/pending_requests.html", dict( total=total, requests=reqs, baseurl=self.baseurl, listingurl=self.listingurl ) ) status, msg = sendmail_simple( self.sender, rcpt, subject=_("[modoboa] Pending release requests"), content=content, server=self.options["smtp_host"], port=self.options["smtp_port"] ) if not status: print msg
def send_pr_notification(self, rcpt, reqs): if self.options["verbose"]: print "Sending notification to %s" % rcpt total = reqs.count() reqs = reqs.all()[:10] content = render_to_string( "amavis/notifications/pending_requests.html", dict(total=total, requests=reqs, baseurl=self.baseurl, listingurl=self.listingurl)) status, msg = sendmail_simple( self.sender, rcpt, subject=_("[modoboa] Pending release requests"), content=content, server=self.options["smtp_host"], port=self.options["smtp_port"]) if not status: print msg
def send_spam(request): status, error = sendmail_simple("*****@*****.**", request.user.username, content=""" This is the GTUBE, the Generic Test for Unsolicited Bulk Email If your spam filter supports it, the GTUBE provides a test by which you can verify that the filter is installed correctly and is detecting incoming spam. You can send yourself a test mail containing the following string of characters (in upper case and with no white spaces and line breaks): XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X You should send this test mail from an account outside of your network. """) if status: return render_to_json_response(_("Message sent")) return render_to_json_response(respmsg=error, status=500)