How to send an email with Python?

I recommend that you use the standard packages email and smtplib together to send email. Please look at the following example (reproduced from the Python documentation). Notice that if you follow this approach, the “simple” task is indeed simple, and the more complex tasks (like attaching binary objects or sending plain/HTML multipart messages) are accomplished … Read more

Insert a line break in mailto body

I would suggest you try the html tag <br>, in case your marketing application will recognize it. I use %0D%0A. This should work as long as the email is HTML formatted. <a href=”https://stackoverflow.com/questions/22765834/mailto:email@mycompany.com?subject=Subscribe&body=Lastame%20%3A%0D%0AFirstname%20%3A”><img alt=”Subscribe” class=”center” height=”50″ src=”subscribe.png” style=”width: 137px; height: 50px; color: #4da6f7; font-size: 20px; display: block;” width=”137″></a> You will likely want to take out … Read more

require(vendor/autoload.php): failed to open stream

What you’re missing is running composer install, which will import your packages and create the vendor folder, along with the autoload script. Make sure your relative path is correct. For example the example scripts in PHPMailer are in examples/, below the project root, so the correct relative path to load the composer autoloader from there … Read more

How can I send mail from an iPhone application

On iOS 3.0 and later you should use the MFMailComposeViewController class, and the MFMailComposeViewControllerDelegate protocol, that is tucked away in the MessageUI framework. First add the framework and import: #import <MessageUI/MFMailComposeViewController.h> Then, to send a message: MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init]; controller.mailComposeDelegate = self; [controller setSubject:@”My Subject”]; [controller setMessageBody:@”Hello there.” isHTML:NO]; if (controller) [self … Read more

PHPMailer character encoding issues

If you are 100% sure $message contain ISO-8859-1 you can use utf8_encode as David says. Otherwise use mb_detect_encoding and mb_convert_encoding on $message. Also take note that $mail -> charSet = “UTF-8″; Should be replaced by: $mail->CharSet=”UTF-8”; And placed after the instantiation of the class (after the new). The properties are case sensitive! See the PHPMailer … Read more

Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage”, referenced from: error

You can get this type of error if your class’ .m file is not listed under the “Compile Sources” step of the “Build Phases” tab of your target. Normally Xcode does this for you, but sometimes it loses the plot and you need to add the .m file manually. To do this: TargetSettings -> Build … Read more

Creating email templates with Django

From the docs, to send HTML e-mail you want to use alternative content-types, like this: from django.core.mail import EmailMultiAlternatives subject, from_email, to = ‘hello’, ‘from@example.com’, ‘to@example.com’ text_content=”This is an important message.” html_content=”<p>This is an <strong>important</strong> message.</p>” msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, “text/html”) msg.send() You’ll probably want two templates for your e-mail – a … Read more

What is the email subject length limit?

See RFC 2822, section 2.1.1 to start. There are two limits that this standard places on the number of characters in a line. Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF. As the RFC states later, you can work around this … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)