# Path: yithlibraryserver/email.py
# def send_email(request, template, context, subject, recipients,
#                attachments=None, extra_headers=None):
#     message = create_message(request, template, context, subject, recipients,
#                              attachments, extra_headers)
#     return get_mailer(request).send(message)
# 
# def send_email_to_admins(request, template, context, subject,
#                          attachments=None, extra_headers=None):
#     admin_emails = request.registry.settings['admin_emails']
#     if admin_emails:
#         return send_email(request, template, context, subject, admin_emails,
#                           attachments, extra_headers)


from yithlibraryserver.email import send_email, send_email_to_admins
# (at your option) any later version.
#
# Yith Library Server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.



def send_thankyou_email(request, donation):
    return send_email(
        request,
        'yithlibraryserver.contributions:templates/email_thankyou',
        donation,
        'Thanks for your contribution!',
        [donation['email']],
    )


def send_notification_to_admins(request, donation):
    context = {
        'home_link': request.route_url('home'),
    }
    context.update(donation)
    return send_email_to_admins(
        request,
        'yithlibraryserver.contributions:templates/email_admin_notification',

# Path: yithlibraryserver/email.py
# def send_email(request, template, context, subject, recipients,
#                attachments=None, extra_headers=None):
#     message = create_message(request, template, context, subject, recipients,
#                              attachments, extra_headers)
#     return get_mailer(request).send(message)
# 
# def send_email_to_admins(request, template, context, subject,
#                          attachments=None, extra_headers=None):
#     admin_emails = request.registry.settings['admin_emails']
#     if admin_emails:
#         return send_email(request, template, context, subject, admin_emails,
#                           attachments, extra_headers)


# Path: yithlibraryserver/contributions/email.py
from yithlibraryserver.email import send_email, send_email_to_admins

# (at your option) any later version.
#
# Yith Library Server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.



def send_thankyou_email(request, donation):
    return send_email(
        request,
        'yithlibraryserver.contributions:templates/email_thankyou',
        donation,
        'Thanks for your contribution!',
        [donation['email']],
    )


def send_notification_to_admins(request, donation):
    context = {
        'home_link': request.route_url('home'),
    }
    context.update(donation)
    return send_email_to_admins(
        request,
        'yithlibraryserver.contributions:templates/email_admin_notification',

        context,