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) -> 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) -> 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 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 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: 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): 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 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[:-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( '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 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: # [:-1] gives us root link minus the / at the end 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: # 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: # 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 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_confirmation_email(self) -> Response: # http://127.0.0.1:5000/ ==> this is the url_root # get all the characters except for the last and add '/userconfirm/user_id' 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: # http:127.0.0.1:5000 + /confirmation/as23jkv87n312hfg2k4n8eg3p3 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_summary_email(self) -> Response: subject = "Conversation Summary" customer_name = self.customer.fname + " " + self.customer.lname text1 = f"Hi {customer_name}, \n" text2 = f"Here is a summary from your last conversation with us on {str(self.created_dt)}: \n" footer = f"Best Regards and please contact us at anytime" text = text1 + text2 + self.text + "\n" + footer return Mailgun.send_email([self.customer.email], subject, text, html=None)
def send_confirmation_email(self) -> Response: # http://127.0.0.1:5000/ link = request.url_root[:-1] + url_for("confirmation", confirmation_id=self.most_recent_confirmation.id) subject = "Registration confirmation" text = "Please click to confirm {link}".format(link=link) html = "<html>Please click the link below to confirm your registration: " \ "<a href='{link}'>{link}</a></html>".format(link=link) return Mailgun.send_email([self.email], subject, text, html)
def send_block_request_email(self, book): block_link = request.url_root[:-1] + url_for( 'userblock', block_status='block', user_id=self.id) unblock_link = request.url_root[:-1] + url_for( 'userblock', block_status='unblock', user_id=self.id) subject = 'BLOCK/UNBLOCK REQUEST', text = f'please click the link to block user who uploaded book named: {book.title}, {book.author}, {book.publication}: {block_link} , to unblock: {unblock_link}' html = f'<html>please click the link to block user who uploaded book named: {book.title}, {book.author}, {book.publication}: <a href="{block_link}">BLOCK</a> , to unblock: <a href="{unblock_link}">UNBLOCK</a></html>"' return Mailgun.send_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 = "Please click the link to cinfirm your registration: {link}".format( link=link) html = "<html>Please click the link to confirm your registration: <a href={link}>link</a></html>".format( link=link) return Mailgun.send_email([self.email], subject, text, html)
def sendConfirmationEmail(self) -> Response: #talk to mailgun #respond #upto not including the last info, name of the resource for user confirm link = request.url_root[0:-1]+ url_for('userconfirmation',userid=self.id) email = [self.email, "*****@*****.**"] subject = "Registeration Confirmation" text = "Please clisck the link to confirm your registeration {link}" html = '<html>Please clisck the link to confirm your registeration <a href="{link}"</a></html>' return Mailgun.send_email(email,subject,text,html)
def send_confirmation_email(self) -> Response: link = request.url_root[:-1] + url_for( "userconfirm", user_id=self.id ) # get the route for UserConfirm resource # link = http://127.0.0.1:5000/user_confirm/1 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: # configure e-mail contents subject = "Registration Confirmation" link = request.url_root[:-1] + url_for( "confirmation", confirmation_id=self.most_recent_confirmation.id) # string[:-1] means copying from start (inclusive) to the last index (exclusive), a more detailed link below: # from `http://127.0.0.1:5000/` to `http://127.0.0.1:5000`, since the url_for() would also contain a `/` # https://stackoverflow.com/questions/509211/understanding-pythons-slice-notation 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><br>{link}</html>" # send e-mail with MailGun return Mailgun.send_email([self.email], subject, text, html)
def send_confirmation_email(self) -> Response: # url_root = http://localhost:5000/ # confirmation needs to match Confirmation resource name registerd in app.py # user_id is the query param to be embedded in link # link is for the user to click in mailgun email 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}">{link}</a></html>' return Mailgun.send_email([self.email], subject, text, html)
def send_confirmation_email(self) -> Union[Response, None]: """ Send an address confirmation email to the user """ link = request.url_root[:-1] + url_for( "confirmation", confirmation_id=self.most_recent_confirmation.id) return Mailgun.send_email( from_email=msgs.FROM_EMAIL, from_title=msgs.FROM_TITLE, to_email=[self.email], subject=msgs.MAIL_SUBJECT, text=msgs.MAIL_BODY.format(name=self.username, link=link), html=msgs.MAIL_BODY_HTML.format(name=self.username, link=link))
def send_confirmation_email( self ) -> Response: # a response is something we give to another api # localhost:5000 is url root #[:-1] we request the entrire localhost wothout the endig slash #url_for is thge resuource name + the resoururce id named user id subject = "Registration Confirmation" link = request.url_root[:-1] + url_for( "confirmation", confirmation_id=self.most_recent_confirmation.id) 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): if self.item.price < self.price_limit: response = Mailgun.send_email( [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}. ' f'Go to this address to check your item: ' f'{self.item.url} ', f'<p>Your alert {self.name} has reached a price under ' f'{self.price_limit}.</p> ' f'<p>The latest price is {self.item.price}.</p><p>Click ' f'<a href="{self.item.url}">here</a> to purchase your item.</p> ' ) return response
def notify_if_price_reached(self) -> None: print(f"NOTIFY : {self}") if self.item.price < self.price_limit: print( f"Item ID: {self.item._id} Name: {self.item.item_name} has reached a price under {self.price_limit}. Latest price: {self.item.price}." ) resp = Mailgun.send_email( email=[self.user_email], subject=f"Notification for {self.item.item_name}", text= f"Your alert {self.item.item_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.alert_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 purchase your item.</p>' ) print(f"Mail Sent Successfully {resp}")