Upload
ngothu
View
234
Download
0
Embed Size (px)
Citation preview
EMAIL INTO REVENUE
SMTP Relay Setup Guide
Campaigner SMTP Relay integrates with many popular software applications, code bases, and CMS systems.
Select from the SMTP configuration profiles samples and instructions on setup for your SMTP relay application.
EMAIL INTO REVENUE
SMTP RELAY SETUP GUIDE 1
Setup ListWindows
• Outlook 2013
• Outlook 2010
• Outlook Express
• Thunderbird
Apple Mac
• Apple Mail
• Eudora 8
• Eudora 7
• Outlook 2011
Source Code Examples
• PHP Script
• PHP Mailer
• Perl Script
• Java
• Node JS
• Python Script
• C#
• Ruby
• Telnet
CMS
• WordPress
• Drupal
• Joomla
• Magento
General SettingsSMTP Server: relay.csmtp.netSMTP Port: 25SMTP Encryption: TLS/SSL is optional. TLS is available on port 587. SSL is available on ports 465.SMTP Username: Your Campaigner SMTP login.SMTP Password: Your Campaigner SMTP password. Be sure authentication setting is turned on
EMAIL INTO REVENUE
Source Code ExamplesPHP Script
<?phprequire_once “Mail.php”; $from = “Sender Name <[email protected]>”;$to = “Recipient Name <[email protected]>”;$subject = “Subject Hello World”;$body = “Body,\n\n Hello World?”; $host = “relay.csmtp.net”;$port = “25”;$username = “smtp_username”;$password = “smtp_password”; $headers = array (‘From’ => $from,‘To’ => $to,‘Subject’ => $subject);$smtp = Mail::factory(‘smtp’,array (‘host’ => $host,‘port’ => $port,‘auth’ => true,‘username’ => $username,‘password’ => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) {echo(“<p>” . $mail->getMessage() . “</p>”);} else {echo(“<p>Message successfully sent!</p>”);}?>
SMTP RELAY SETUP GUIDE 18
EMAIL INTO REVENUE
PHP Mailer
Step One • Download PHPMailer from CodeWorxTech and extract it into your desired location.• Go to the extracted folder and copy following files to your web server root directory:
class.phpmailer.phpclass.smtp.php
Step Two
Create a file called CampaignerSMTP.php
<?phprequire(“class.phpmailer.php”); // path to the PHPMailer class. $mail = new PHPMailer();$mail->IsSMTP();$mail->Mailer = “smtp”;$mail->Host = “relay.csmtp.net”; $mail->Port = “25”; // Use Port 465 for SSL.$mail->SMTPAuth = true;//$mail->SMTPSecure = ‘ssl’; // Uncomment this line if you want to use SSL.$mail->IsHTML(true); //Set HTML $mail->Username = “your_smtp_username”;$mail->Password = “your_smtp_password”; $mail->From = “[email protected]”;$mail->FromName = “Sender’s Name”;$mail->AddAddress(“[email protected]”, “First Last Recipient”);$mail->AddReplyTo(“Your Reply-to Address”, “Sender’s First Last Name”); $mail->Subject = “Your Subject!”;$mail->Body = “Hello World, your body”;$mail->WordWrap = 80; if(!$mail->Send()) { echo ‘Message was not sent.’; echo ‘Mailer error: ‘ . $mail->ErrorInfo; exit;} else { echo ‘Message has been sent.’;}?>
SMTP RELAY SETUP GUIDE 19
EMAIL INTO REVENUE
Perl Script
#!/usr/bin/perluse Net::SMTP_auth;use MIME::Entity;use Net::SMTP;
my $username = ‘USERNAME’;my $password = ‘PASSWORD’;my $smtp;
my $from = ‘[email protected]’;my $to = ‘[email protected]’;my $subject = ‘Subject Hello World’;my $text_message = “Text Body, Hello world\n”;my $html_message = “HTML Body, <strong>hello world</strong>”;my $message = MIME::Entity->build ( To => $to, Subject => $subject Type => ‘multipart/alternative’, From => $from, );
$message->attach(Type => ‘text/html’, Data => $html_message);$message->attach(Type => ‘text/plain’, Data => $text_message);
if (not $smtp = Net::SMTP->new(‘relay.csmtp.com’, Port => 25, # 8025, 587 and 25 can also be used. Timeout => 30)) { die “failed to connect\n”;}
$smtp->auth($username, $password) || die “failed to authenticate! \n”;$smtp->mail($from);$smtp->to($to);$smtp->data($message->as_string);$smtp->quit;
SMTP RELAY SETUP GUIDE 20
EMAIL INTO REVENUE
JavaPlease make sure that you have necessary java libraries being used in this java source.
package campaignersmtp;import java.util.Properties;import javax.mail.*;import javax.mail.internet.*;public class campaignersmtp;{ public static void main(String[] args) { finalStringusername=“USERNAME”; finalStringpassword=“PASSWORD”; Properties props = new Properties(); props.put(“mail.smtp.auth”, “true”); //props.put(“mail.smtp.starttls.enable”, “true”); // Uncomment, if you want to use TLS. props.put(“mail.smtp.host”, “relay.csmtp.net”); props.put(“mail.smtp.port”, “25”); // 8025, 587 and 25 can also be used. Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); Multipart mp = new MimeMultipart(“alternative”); BodyPart textmessage = new MimeBodyPart(); textmessage.setText(“It is a text message \n”); BodyPart htmlmessage = new MimeBodyPart(); htmlmessage.setContent(“html message here.”, “text/html”); mp.addBodyPart(textmessage); mp.addBodyPart(htmlmessage); message.setFrom(new InternetAddress(“[email protected]”)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(“[email protected]”)); message.setSubject(“CampaignerSMTP Mail sent via Java”); message.setContent(mp); Transport.send(message); System.out.println(“Done”); } catch (MessagingException e) { throw new RuntimeException(e); } }}
SMTP RELAY SETUP GUIDE 21
EMAIL INTO REVENUE
Node JSvar nodemailer = require(“nodemailer”);
var smtpTransport = nodemailer.createTransport(“SMTP”,{ host: “relay.csmtp.net”, port: 25, auth: { user: “USERNAME”, pass: “PASSWORD” }});
smtpTransport.sendMail({ from: “Sender Name <[email protected]>”, to: “Recipient Name <[email protected]>”, subject: “Your Subject Goes Here”, text: “This is your text email message”}, function(error, response){ if(error){ console.log(error); }else{ console.log(“Message sent: “ + response.message); }});
Python Script#!/usr/bin/python
import smtplibfrom email.MIMEMultipart import MIMEMultipartfrom email.MIMEBase import MIMEBasefrom email.MIMEText import MIMETextfrom email import Encodersimport os
username = ‘USERNAME’password = ‘PASSWORD’msg = MIMEMultipart(‘alternative’)
sender = ‘[email protected]’recipient = ‘[email protected]’
msg[‘Subject’] = ‘This is Your Subject’msg[‘From’] = sendermsg[‘To’] = recipient
SMTP RELAY SETUP GUIDE 22
EMAIL INTO REVENUE
text_message = MIMEText(‘Your text message.’, ‘plain’)html_message = MIMEText(‘Your html message.’, ‘html’)msg.attach(text_message)msg.attach(html_message)
mailServer = smtplib.SMTP(‘relay.csmtp.net’, 25)mailServer.ehlo()mailServer.starttls()mailServer.ehlo()mailServer.login(username, password)mailServer.sendmail(sender, recipient, msg.as_string())mailServer.close()
C#using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net.Mail;using System.Net.Mime;using System.Net;
namespace csmtpMail{ class Program { static void Main(string[] args) { try { var mail = new MailMessage(); var client = new SmtpClient(“relay.csmtp.net”, 25) { Credentials = new NetworkCredential(“USERNAME”, “PASSWORD”), EnableSsl = true }; mail.From = new MailAddress(“[email protected]”); mail.To.Add(“[email protected]”); mail.Subject = “Subject, hello world”; var htmlView = AlternateView.CreateAlternateViewFromString(“<b>This is a html message</b>”, null, “text/html”); var plainView = AlternateView.CreateAlternateViewFromString(“This is a text message”, null, “text/plain”); mail.AlternateViews.Add(htmlView); mail.AlternateViews.Add(plainView);
SMTP RELAY SETUP GUIDE 23
EMAIL INTO REVENUE
client.Send(mail); Console.WriteLine(“Sent email”); Console.ReadLine(); } catch (Exception exc) { Console.WriteLine(exc.Message); } } }}
Ruby
#!/usr/bin/ruby
begin require ‘rubygems’ require ‘mail’ rescue LoadError => e puts “Missing Dependency #{e.message}” exit 1end
mail = Mail.new do from ‘[email protected]’ to ‘[email protected]’ subject “Your Subject Here” text_part do body ‘This is your text message’ end html_part do content_type ‘text/html; charset=UTF-8’ body ‘<b>This is your html message</b>’ endendNet::SMTP.start(‘relay.csmtp.net’, 25, ‘yourdomain.com’, ‘USERNAME’, ‘PASSWORD’, :login) do |smtp| smtp.send_message(mail.to_s, ‘[email protected]’, ‘[email protected]’)end
SMTP RELAY SETUP GUIDE 24
EMAIL INTO REVENUE
TelnetFrom CMD prompt (Start > Run > CMD.exe)
c:\telnet relay.csmtp.net 25 (return) 220 relay.csmtp.net ESMTP service ready(type) ehlo (return) 250-relay.csmtp.net ESMTP service Hello , [50.195.23.206], welcome. 250-8BITMIME 250-STARTTLS 250-AUTH=LOGIN 250-AUTH=PLAIN 250-SIZE=26214400 250 ENHANCEDSTATUSCODES(type) auth login (return) 334 VXNlcm5hbWU6(type) <your base 64 encoded user name> (return) 334 UGFzc3dvcmQ6(type) <your base 64 encoded password> (return) 235 2.7.0 Authentication successful(type) mail from: <[email protected]> (return) 250 2.1.0 Sender address accepted(type) rcpt to: <[email protected]> (return) 250 2.1.5 Recipient address accepted(type) data (return) 354 Please start mail input.(type) To: To Name Here (return)(type) From: From Name Here (return)(type) Subject: This is a TELNET Subject test (return)(type) This is the body message (return)(when done, type “.” on it’s own line to deliver the email)(type) . (return) 250 Mail queued for delivery.(type) quit (return) 221 Closing connection. Good bye.
Connection to host lost.
SMTP RELAY SETUP GUIDE 25
EMAIL INTO REVENUE
CMSWordPress
Download SMTP WordPress module:http://wordpress.org/extend/plugins/wp-smtp/
Step One
Step Two
SMTP RELAY SETUP GUIDE 26
EMAIL INTO REVENUE
DrupalDownload SMTP Authentication Module:http://drupal.org/project/smtp
Step One
Step Two
SMTP RELAY SETUP GUIDE 27
EMAIL INTO REVENUE
MagentoInstall one of the supported SMTP Extension through Magento Connect. We recommend ASchroder.com:http://www.magentocommerce.com/magento-connect/ASchroder/extension/1865/aschroder.com-smtp-pro
Step One
Step Two
SMTP RELAY SETUP GUIDE 30EMAIL INTO REVENUE
EMAIL INTO REVENUE
About CampaignerCampaigner is a robust email marketing solution built by marketers to help small, medium and large businesses strengthen customer relationships and drive sales. Features include professional email campaign creation, industry-leading A/B split testing, advanced list management and segmentation tools, targeted email autoresponders and workflows, powerful API and CRM integration, and detailed campaign reporting. Campaigner is a brand and registered trademark of the Business Cloud Services Division of j2 Global, Inc., the global provider of Internet services. Learn more at www.Campaigner.com.
EMAIL INTO REVENUE
SMTP RELAY SETUP GUIDE 31
Contact a Sales Rep to add SMTP Relay today
1-877-564-9063
CP-1-23/08/16