def notify_if_price_reached(self) -> None: """Sends a notification if the target price is reached.""" if self.item.price < self.price_floor: print(f'Item {self.item} has reached a price below ' f'{self.price_floor}.\n Latest price: {self.item.price}.') Mailgun.send_mail(['*****@*****.**'], 'Test Subj', 'This is a test.', '<p>This is an HTML test.</p>')
def notify_if_price_reached(self): if self.price < float(self.Price_limit): print( f"item {self.name} has reached a price lower than the price limit {self.Price_limit}, its price is {self.price}" ) Mailgun.send_mail([self.user_email], 'notification for {}'.format( self.name), 'the price limit has been reached desired price.')
def send_confirmation_email(self): # # argument in url_for automatically remove special characters like user_confirmed becomes userconfirmed link = request.url_root[:-1] + url_for("userconfirmed", user_id=self.id) subject = "Registration Confirmation", text = f"Please click the link to confirmation your registration: {link}" html = f'<html>Please click the link to confirmation your registration: <a href="{link}">{link}</a></html>' Mailgun.send_email(self.email, subject, text, html)
def notify_if_price_reached(self): if self.item.price < self.price_limit: # print(f"Item {self.item} has reached a price under {self.price_limit}. Latest price: {self.item.price}.") Mailgun.send_mail( [self.user_email], f'Notification for {self.name}', f'Your alert {self.name} has reached a price under {self.price_limit}, the latest price is {self.item.price}. Go to this address to check your item: {self.item.url}.', f'<p>Your alert {self.name} has reached a price under {self.price_limit}, the latest price is {self.item.price}.</p><p>Click <a href="{self.item.url}">here</a> to purchase your item.</p>' )
def notify_if_price_reached(self): if self.item.price < self.price_limit: Mailgun.send_mail( [self.user_email], f'Notification for {self.name}', f'Your alert for {self.name} has reached a price under {self.price_limit}. The latest price is {self.item.price}. Go to this address to check the item: {self.item.url}.', f'<p>Your alert {self.name} has reached a price under {self.price_limit}.</p><p>The latest price is {self.item.price}</p><p>Click <a href="{self.item.url}">here</a> to view the item.' )
def notify_if_price_reached(self) -> None: if self.item.price < self.price_limit: print(f"Item {self.item} has reached a price under {self.price_limit}. Latest price: {self.item.price}.") Mailgun.send_email( email=[self.user_email], subject=f"Notification for {self.name}", text=f"Your alert {self.name} has reached a price under {self.price_limit}. The latest price is {self.item.price}. Go to this address to check your item: {self.item.url}.", html=f'<p>Your alert {self.name} has reached a price under {self.price_limit}.</p><p>The latest price is {self.item.price}. Check your item out <a href="{self.item.url}>here</a>.</p>', )
def notifiy_if_price_reached(self): if self.item.price < self.price_limit: print( f"Item {self.name} has reached a price under {self.price_limit}. Latest price: {self.item.price}" ) Mailgun.send_mail( [self.user_email], f'Notification for {self.name}', '', f'<p>Your alert {self.name} has reached a price under {self.price_limit}. The latest price is {self.item.price}.</p><p>Go to this address to check your item: {self.item.url}</p>' )
def notify_if_price_reached(self) -> None: if self.item.price < self.price_limit: print(f"Item {self.item} has reached a price under {self.price_limit}. Latest price: {self.item.price}") Mailgun.send_email( [self.user_email], f"Notification for {self.name}", f"Your alert {self.name} has reached a price under {self.price_limit}. The latest price is {self.item.price}. Go to this address to check your item: {self.item.url}", f'<p>Your alert {self.name} has reached a price under {self.price_limit}. The latest price is {self.item.price}.</p><p>Click <a href="{self.item.url}">here</a> to see your item.</p>')
def notify_if_price_reached(self): if self.item.price < self.price_limit: print(f"Item {self.item} has reached a price under {self.price_limit}. Latest price: {self.item.price}.") Mailgun.send_mail( ['*****@*****.**'], f'Notification for {self.name}', f'Your alert {self.name} for the product {self.item.url} has reached a price under {self.price_limit}', f'<h1>HELLO</h1> <p>This is wonderful</p> <p>Click <a href="{self.item.url}">here</a> to purchase your item.</p>' )
def notify_if_price_reached(self): if self.item.price < self.price_limit: Mailgun.send_mail( [self.user_email], f'Notification for {self.name}', f'Your alert {self.name} has reached a price under {self.price_limit}.' f' The latest price is {self.item.price}. Go to {self.item.url} to check your item.', f'<p>Your alert {self.name} has reached a price under {self.price_limit}.' f' The latest price is {self.item.price}. Click <a href="{self.item.url}">Here</a> to check your item.</p>' )
def notify_if_price_reached(self): if self.item.price < self.price_limit: Mailgun.send_mail( [self.user_email], f"Notification for {self.name}", f"""Your alert {self.name} has reached a price under {self.price_limit}. The latest price is {self.item.price}. Go to this address to check your item{self.item.url}.""", f"""<p>Your alert {self.name} has reached a price under {self.price_limit}.</p><p>The latest price is {self.item.price}. Click <a href='{self.item.url}'>here</a> to check your item.</p>""" )
def notify_if_price_reached(self): if self.item.price < self.price_limit: print( f'Item {self.item} has reached {self.item.price} in price, and is now below {self.price_limit}.') Mailgun.send_mail( ['*****@*****.**'], f'Notification for {self.name}', f'Your alert {self.name} has reached a price under {self.price_limit}. The latest price is {self.item.price}. Go to the address to check your item: {self.item.url}', f'<p>Your alert {self.name} has reached a price under {self.price_limit}.</p><p>The latest price is {self.item.price}.</p><p>Click <a href="{self.item.url}">here</a> to purchase your item.</p>' )
def notify_price_reached(self) -> None: self.item.load_price() if self.item.price < self.price_limit: Mailgun.send_email( user_email=User.get_by_id(self.user_id).email, subject=f"Sale for item: {self.item.name}", text= f"Your item '{self.item.name}' has reached a price below {self.price_limit}! Latest price is {self.item.price}. Click {self.item.url} to visit item page.", html= f"<p>Your alert {self.item.name} has triggered and the item is priced under: {self.price_limit}.</p><p>The latest price is {self.item.price}. Visit item page <a href={self.item.url}>here</a>.</p> " )
def notify_if_price_reached(self): if self.item.price < self.price_limit: print( f"Item {self.item} has reached a price lower than {self.price_limit}. The current price is {self.item.price}" ) Mailgun.send_mail( [self.user_email], f"Notification for {self.name}", f"Your alert {self.name} has reached a price under {self.price_limit}. The latest price is {self.item.price}." f"Go to this address to check your item: {self.item.url}", f"<p>Your alert {self.name} has reached a price under {self.price_limit}.</p> " f"<p>The latest price is {self.item.price}.</p>" f"<p>Click <a href={self.item.url}>here</a> to check your item.</p>" )
def send_registration_message(event_id, user_details): try: details = Events.objects.get(id=event_id) Mailgun.send_mail( [user_details.email], "Thankyou For showing interest!", "Thankyou For showing interest!", "<p>Hi " + str(user_details.username) + ",<br><br> Thankyou for registering for the event - " + str(details.event_subject) + ".The Event will be held on " + str(details.event_date) + " make sure you are available.<br><br> Regards,<br> Team AMS <p>") except Exception: print("Something went wrong!")
def notify_if_price_reached(self): print(self.item.precio_dolar) print(self.price_limit) if self.item.precio_dolar > self.price_limit: print( f' Alerta: el precio subiò de {self.price_limit}. El valor actual es de {self.item.precio_dolar}' ) Mailgun.send_mail( ['*****@*****.**'], f'Hello, notificacion de {self.name}', f'Alerta: el precio subiò de {self.price_limit}. El valor actual es de {self.item.precio_dolar}', f'<p>Your alert {self.name} has reached a price subiò {self.price_limit}.</p><p>El precio actual es de {self.item.precio_dolar}. Check your item out <a href="{self.item.url}>here</a>.</p>', )
def notify_if_price_reached(self): if self.item.price < self.price_limit: print( f"The item ({self.item} has reached a price below the limit ({self.price_limit}).\n" f"The latest price is: {self.item.price}") Mailgun.send_mail( [self.user_email], f"Notification for {self.name}", f"This alert has reached a price under {self.price_limit}. " f"The current price is {self.item.price}." f"Check the current price at this url: {self.item.url}", f"<p>This alert has reached a price under {self.price_limit}.</p>" f"<p>The current price is {self.item.price}.</p>" f"<p>Click <a href='{self.item.url}'>here</a> to view your item in the browser.</p>", )
def send_confirmation_email(self): link = request.url_root[:-1] + url_for( 'confirmation', confirmation_id=self.most_recent_confirmation.id) subject = 'Registration Confirmation', text = f'please click the link to confirm your registration: {link}' html = f'<html>please click the link to confirm your registration: <a href="{link}">{link}</html>"' return Mailgun.send_email([self.email], subject, text, html)
def send_confirmation_email(self) -> Response: link = f"http://127.0.0.1:5000/confirm/{self.most_recent_confirmation.id}" # link = request.url_root[:-1] + url_for("userconfirm", user_id=self.id) subject = "Registration Confirmation" text = f"please click the following link to activate your account {link}" return Mailgun.send_email([self.email], subject, text)
def send_confirmation_email(self) -> Response: link = request.url_root[:-1] + url_for("userconfirm", user_id=self.id) subject = "Registration confirmation" text = f"Please click the link to confirm your registration: {link}" html = f'<html>Please click the link to confirm your registration: <a href="{link}">{link}</a></html>' return Mailgun.send_email([self.email], subject, text, html)
def send_confirmation_email(self) -> Response: link = request.url_root[:-1] + url_for( 'confirmation', confirmation_id=self.most_recent_confirmation.id) subject = 'Registration confirmation' text = f'Please click the link to confirm your registration: {link}' html = f'<html>Please click on the link to confirm <a>href="{link}"</a>{link}</html>' return Mailgun.send_email([self.email], subject, text, html)
def send_confirmation_email(self) -> Response: link = request.url_root[:-1] + url_for( "confirmation", confirmation_id=self.most_recent_confirmation.id) subject = "Registration Confirmation" text = f"Please click on the link to confirm your registration: {link}" html = f'<html>Please click on the link to confirm your registration: <a href="{link}">link</a></html>' return Mailgun.send_email([self.email], subject, text, html)
def send_confirmation_email(self): link = request.url_root[0:-1] + url_for( "confirmation", confirmation_id=self.most_recent_confirmation.id) subject = "Registration Confirmation" text = f"Please click the link to confirm your registration. {link}" html = f"<html>Please Click the link to confirm your registration. <a href='{link}'>Click Here!!</a></html>" return Mailgun.send_email([self.email], subject, text, html)
def send_confirmation_email(self) -> Response: link = request.url_root[:-1] + url_for('confirmation', confirmation_id=self.most_recent_confirmation.id) subject = 'Registration Confirmation.' text = f"Please click the link to confirm your registration {link}." html = f"<html>Please click the link to confirm your registration <a href='{link}'>link</a></html>" return Mailgun.send_email([self.email], subject, text, html)
def send_confirmation_email(self) -> Response: # remove end slash from http://127.0.0.1:5000 + /user_confirm/1 link = request.url_root[:-1] + url_for( "confirmation", confirmation_id=self.most_recent_confirmation.id) subject = "Registration confirmation" text = f"Please click the link to confirm your registration: {link}" html = f'<html>Please click the link to confirm your registration: <a href="{link}">{link}</a></html>' return Mailgun.send_email([self.email], subject, text, html)
def notify_if_price_reached(self) -> None: """ This method will notify the user if the specified price limit was reached :return: Print notification that item is below specified price """ if self.item.price < self.price_limit: # print( # f"Item {self.item} has reached a price under {self.price_limit}. Latest price: {self.item.price}." # ) Mailgun.send_email( email=[self.user_email], subject=f"Notification for {self.name}", text=f"Your alert {self.name} has reached a price under {self.price_limit}. The latest price is {self.item.price}. Go to this address to check your item: {self.item.url}.", html=f'<p>Your alert {self.name} has reached a price under {self.price_limit}.</p>' f'<p>The latest price is {self.item.price}. Check your item out <a href="{self.item.url}">here</a>.</p>', )
def send_confirmation_email(self) -> Response: # http:127.0.0.1:5000 + /user_confirm/1 link = request.url_root[:-1] + url_for("userconfirm", user_id=self.id) subject = 'Registraction confirmation' text = f'Please click the link to confirm your registration: {link}' html = f'<html>Please click the link to confirm your registration: <a href="{link}">{link}</a></html>' return Mailgun.send_email([self.email], subject, text, html)
def send_confirmation_email(self) -> Response: link = request.url_root[0:-1] + url_for( 'confirmation', confirmation_id=self.most_recent_confirmation.id) subject = 'Registration confirmation' text = f'Please click the link to confirm your registration: {link}' return Mailgun.send_confirmation_email(emails=[self.email], subject=subject, text=text)
def send_confirmation_email(self) -> Response: link = request.url_root[0:-1] + url_for( "confirmation", confirmation_id=self.most_recent_confirmation) subject = "Registration confirmation" text = f"Please click the link to confirm your registration: {link}" return Mailgun.send_email([self.email], subject, text)
def send_creation_message(event_id): try: recievers = [] #gather list of mails in the database for user in User.objects.all(): recievers.append(user.email) details = Events.objects.get(id=event_id) details = Events.objects.get(id=event_id) Mailgun.send_mail( recievers, "Checkout this Event!", "Checkout this Event!", "<p>Title: " + str(details.event_subject) + "<br>Event Date: " + str(details.event_date) + "<br>Organizer name: " + str(details.organizer_name) + "<br>Details: " + str(details.text) + "<br> Venue: " + details.venue + "<br><br> please write to " + str(details.email) + " in case of any queries </p>") except Exception: print("Something went wrong!")