Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
Emails need to have call to actions. It encourages users to pay more, to charge his account or to buy a product.

Display CTAs the right time to target users to increase ROI (return of investment)

#call_to_action #email #end_user #ROI
In case all of a sudden you fell on Outlook for mail templates (yes that sucks!), and you have problem for right to left languages like Farsi read on.

Outlook removes styles from your tags, you need to provide Outlook specific tags for direction named dir. It will solve your RTL problems:
<span dir="rtl"></span>

NOTE: styles like "direction:rtl" wont work on outlook. Beside direction for other mail clients you need to provide dir attribute.

#outlook #email #direction
MYSQL insert

If you have bulk scripts for your email/sms like me, and you are sending to thousands of users, you will difintely will get stuck in the middle of the bulk notification or it will be very slow and unacceptable. First of all you must initiate only ONE mysql connection. If you are inserting your data one by one, you're dead again! try to use executemany that will insert data into mySQL in bulk not one by one:

client.executemany(
"""INSERT INTO email (name, spam, email, uid, email_content)
VALUES (%s, %s, %s, %s, %s)""",
[
("Ali", 0, 'mail1@example.com', 1, 'EMAIL_CONTENT'),
("Reza", 1, 'mail2@example.com', 2, 'EMAIL_CONTENT'),
("Mohsen", 1, 'mail3@example.com', 3, 'EMAIL_CONTENT')
] )

Other note for bulk insertion is to avoid disk IO in case possible, and use redis, memcached or so on for inserting some data like user's phone or emails. It will tremendously improve performance of your bulk script.

#python #mysql #executemany #redis #bulk #email #sms
How to implement email tracking solution?

nginX has a module called empty_gif that generates a 1*1 pixel image. It is usually put at the end of campaign emails in order to track how many users have opened the email. The code for nginX is:

location = /empty.gif {
empty_gif;
expires -1;
post_action @track;
}

location @track {
internal;
proxy_pass http://tracking-backend/track$is_args$args;
proxy_set_header x-ip $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}


The above code check if /empty.gif URL is requested, if answer is yes then serve the image and makes expires to -1 to not cache the image and finally using post_action which calls a sub request after the current request has been fininshed. The parameters you need to pass is put after the image link in email like:

https://www.example.com/empty.gif?token=SOMETHING_TO_TRACK
#nginx #email #empty_gif #email_tracking #pixel