Posts

Showing posts with the label smtp

edx-platform - How to make SMTP work on your Open EdX instance the proper way

There were several threads in the Open EdX mailing list asking about how to make the email working. But, it seams like there is no proper instructions out there to help people. So, I decided to write something about that. Firstly, there are 3 simple things to keep in mind: All the authentication information should be kept privately. If you add them to the edx-platform source files there will be conflicts when you upgrade or pull from master/branches. So, the best place to keep all the settings for all your Open edX applications is /edx/app/edx_ansible/server-vars.yml .  0. Checkout all of your modification on: (to avoid source code conflicts) cms/envs/common.py lms/envs/aws.py cms.env.json cms.auth.json lms.env.json lms.auth.json 1. Create  server-vars.yml   in  / edx/app/edx_ansible/ 2. Add these following variables to server-vars.yml with your SMTP information: EDXAPP_EMAIL_BACKEND: 'django.core.mail.backends. smtp.EmailBackend' EDXAPP_EMAIL_HOST: '...

Generate snapshots report of all VMWare virtual machines using PowerCLI

Ok, so I heard that you're tired of going to every virtual machines in your VMWare vCenter and checking for snapshots that need to be removed. VMWare has provided a solution that can ease your pain, It's PowerCLI . In short,  PowerCLI is a Windows PowerShell interface for managing VMware vSphere. It comes with a lot of useful cmdlets that will help you manipulate your VMWare infrastructure smoothly and painlessly (sort of) including automating tasks. Here is how I can generate a snapshots report of all the virtual machines in my VMWare 6 environment: 1. In a Windows Server 2008 R2 SP1 (or Windows 7 and above), install these dependencies: vSphere client v6 for windows: download here . Microsoft Management Framework 3.0 : download here (for Windows Server 2008 R2 SP1, I will download Windows6.1-KB2506143-x64.msu package) 2. Download and install PowerCLI: Download the latest PowerCLI here . It's PowerCLI 6 R3 at the time I write this article. 3. Open Powe...

Using SMTP for emailing in WordPress Multisite

To enable SMTP emailing (use SMTP instead of mail()) in a WordPress Multisite, you can do this: 1. Install this plugin in network admin dashboard: WP MAIL SMTP ( https://wordpress.org/plugins/wp-mail-smtp/ ) 2. Add these settings to  wp-config.php : define('WPMS_ON', true); define('WPMS_MAIL_FROM', 'myemail@mydomain.com'); define('WPMS_MAIL_FROM_NAME', 'My WordPress Multisite'); define('WPMS_MAILER', 'smtp'); // Possible values 'smtp', 'mail', or 'sendmail'  define('WPMS_SET_RETURN_PATH', 'false'); // Sets $phpmailer->Sender if true define('WPMS_SMTP_HOST', 'smtp.gmail.com'); // The SMTP mail host define('WPMS_SMTP_PORT', 587); // The SMTP server port number define('WPMS_SSL', 'tls'); // Possible values '', 'ssl', 'tls' - note TLS is not STARTTLS define('WPMS_SMTP_AUTH', true); // True turns on SMTP ...

Python - Send email with attachments

This is the code snippet to send an email with attachments using python smtp module:

Debugging SMTP communication in Django

After a while getting trouble with the sending email functionality of my Django app, I read the core of Django and python's smtplib module to find a way to debug the smtp connection. I only need to set the debug level = True when we create the connection in the email backend of Django (or in whatever email backend you're using): django.core.mail.backend.smtp: ---------------------------------------------- def open(self):      ......      self.connection.set_debuglevel = True     ....... ---------------------------------------------- When I send the email from my Django app, the console will give me some useful information Read more about the Django core email backend:  https://github.com/django/django/blob/master/django/core/mail/backends/smtp.py and the smtplib module:  http://docs.python.org/2/library/smtplib.html   It saved my day! \m/\m/\m/