How to send multiple attachment in single mail in php

Following the reusability principles, you can use https://github.com/PHPMailer/PHPMailer <?php require ‘PHPMailerAutoload.php’; $mail = new PHPMailer; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host=”smtp1.example.com;smtp2.example.com”; // Specify main and backup server $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username=”jswan”; // SMTP username $mail->Password = ‘secret’; // SMTP password $mail->SMTPSecure=”tls”; // Enable encryption, ‘ssl’ also accepted $mail->From = … Read more

How to send email with pdf attachment in Python? [duplicate]

You create a message with an email package in this case – from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText from email.MIMEImage import MIMEImage msg = MIMEMultipart() msg.attach(MIMEText(open(“/home/myuser/sample.pdf”).read())) and then send the message. import smtplib mailer = smtplib.SMTP() mailer.connect() mailer.sendmail(from_, to, msg.as_string()) mailer.close() Several examples here – http://docs.python.org/library/email-examples.html UPDATE Updating the link since the above … Read more

Swift_TransportException Connection could not be established with host smtp.gmail.com

Fatal error: Uncaught exception ‘Swift_TransportException’ with message ‘Connection could not be established with host smtp.gmail.com [Connection refused #111] Connection refused is a very explicit and clear error message. It means that the socket connection could not be established because the remote end actively refused to connect. It’s very unlikely that Google is blocking the connection. … Read more

Codeigniter send email with attach file

$this->email->attach() Enables you to send an attachment. Put the file path/name in the first parameter. Note: Use a file path, not a URL. For multiple attachments use the function multiple times. For example: public function setemail() { $email=”[email protected]”; $subject=”some text”; $message=”some text”; $this->sendEmail($email,$subject,$message); } public function sendEmail($email,$subject,$message) { $config = Array( ‘protocol’ => ‘smtp’, ‘smtp_host’ … Read more

Distinguish visible and invisible attachments with Outlook VBA

As I can test so far, an embedded attachment always have a MIME content ID, regardless whether it appears in the mail body. So the solution is to check whether it has a content ID. Here is an example code that counts the visible attachments: Sub ShowVisibleAttachmentCount() Const PR_ATTACH_CONTENT_ID As String = “http://schemas.microsoft.com/mapi/proptag/0x3712001F” Const PR_ATTACHMENT_HIDDEN … Read more

Sending multiple attachment in an email using PHP

Answer There are a few problems with your code that I have detailed below. Line endings $headers=”From:”. $from . “\r\n”; $headers .= “Bcc:”. $bcc . “\r\n”; … // headers for attachment $headers .= “\nMIME-Version: 1.0\n” . “Content-Type: multipart/mixed;\n” . ” boundary=\”{$mime_boundary}\””; // multipart boundary $message = “This is a multi-part message in MIME format.\n\n” . … Read more