ó
¯nyZc           @   sK   d  d l  m Z d  d l m Z d  d l Td  d l Td  d l Td „  Z d S(   iÿÿÿÿ(   t   render(   t   EmailMessage(   t   *c         C   sì   t  j ƒ  } t ƒ  } |  j rÎ t |  j ƒ } | j ƒ  rÎ | j ƒ  } d | j | j | j | j	 f } d } t
 | | d d g ƒ } d | _ y | j ƒ  Wn n Xt |  d i | d 6| d 6t d	 6ƒ Sn  t |  d i | d 6| d 6ƒ S(
   Ns‰   
<p><strong>Name:</strong> %s</p>
<p><strong>Email:</strong> %s</p>
<p><strong>Phone:</strong> %s</p>
<p><strong>Enquiry:</strong> %s</p>s   Enquiry from the YGC websites&   noreply@yorkshiregallstoneclinic.co.uks   Liz.power@spirehealthcare.comt   htmls   contact.htmlt   paget   contact_formt	   submitted(   t   ContactPaget   get_solot   ContactFormt   POSTt   is_validt   savet   namet   emailt	   telephonet   messageR   t   content_subtypet   sendR    t   True(   t   requestR   R   t
   submissionR   t   subjectt   msg(    (    s   /var/www/ygc/contact/views.pyt   contact
   s     		"	(N(   t   django.shortcutsR    t   django.core.mailR   t   modelst   pages.modelst   formsR   (    (    (    s   /var/www/ygc/contact/views.pyt   <module>   s
   


