Tag Archives: email

How to Locate which Ports You can Send out on via SMTP when using a GoDaddy E-mail Account Software & Sites 30 APR 2012

A port is just a port, and just because there is a standard one that is used by something, it doesn’t mean you always have to use the default port for doing that something. Enter sending out an e-mail message via SMTP when using a GoDaddy e-mail account.

Although GoDaddy restricts incoming e-mail to ports 110 and 995 (SSL), outgoing SMTP ports (usually via its smtpout.secureserver.net server) are a little more open. This tutorial will teach you how to find out which ports are available for you to use in your e-mail sending application.

First, login to GoDaddy’s site (http://www.godaddy.com) and click on the “Email” button on the main green menu bar. If you have any active e-mail accounts, they will be listed, and to the right of each entry you will find a green launch button. Clicking on this will open the Control Center.

Once in the Control Center, you’ll see your e-mail addresses listed under the Email Plans folder. The addresses are laid out in a table, with the columns, Address, Size, Relays, Attributes, and Actions.

In the Actions column you will see a Tools icon. Click on it to launch the Info Center.

The Email Info Center is a one-page view of your e-mail address account settings. Under the fieldset entitled “Email Server Settings”, you will spot a label “Outgoing server (SMTP):”, giving you the server details to use, as well as a list of available and open ports. Score!

So if you want to move away from the standard port 25 and perhaps now send out on port 80 via your PHPMailer-using PHP script, your code would look like this:

$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtpout.secureserver.net"; // specify main and backup server
$mail->Port = 80; // new port
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "username@mydomain.com"; // SMTP username
$mail->Password = "mypassword"; // SMTP password

Nifty.

How to Add a CC E-mail Address with PHPMailer Programming 02 APR 2012

I’ve moved to the fantastic PHPMailer PHP class to handle all my e-mail send outs for my projects and have thus far been quite impressed by the ease-of-use and robustness of the class.

Today’s code snippet will show you just how easy it is to add CC (“carbon copy” or “courtesy copy” depending in what era you were born!) e-mail addresses to a e-mail send out, thus saving computing time by pushing out a single mail send instead of a number of separate ones for each attached address (well technically, we’re just foisting all the work onto the SMTP server, but still, less work that the web server needs to do, i.e. a win for us!).

In code:

//create the mail class and fill in all the required settings
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.server.net";
$mail->SMTPAuth = true;
$mail->Username = "username@domain.com";
$mail->Password = "password1";
$mail->From = "username@domain.com";
$mail->FromName = "Software Simian";
$mail->AddAddress("targetguy@domain.com", "Target Guy");
$mail->AddReplyTo("username@domain.com", "Software Simian");
$mail->Subject = "Subject";
$mail->Body = "Message";
$mail->AltBody = strip_tags("Message:);
 
//and now for the actual bit of adding multiple CC e-mail addresses
$mail->AddCC("extra-address1@domain.com");
$mail->AddCC("extra-address2@domain.com");
$mail->AddCC("extra-address3@domain.com");
 
//and send. Now was that not easy?
if(!$mail->Send()){
    $resultstatus = 'Failed';
}

The code above will result in a mail being sent out to four addresses instead of just the main specified address.

Nifty.

PHP and PHPMailer: How to Check if Your Mail Send Failed CodeUnit 21 DEC 2011

PHPMailer is a great little mail sending workhorse class for PHP, widely expanding on the regular PHP mail() function and particularly easy to make use of, making it a personal favourite of mine.

Anyway, to check whether or not your mail send was successful when using PHPMailer, all you need to do is check the Boolean variable returned by the Send() function, and if false, check what the error message contained in ErrorInfo is.

In practice:

require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp1.example.com;smtp2.example.com";
$mail->SMTPAuth = true;
$mail->Username = 'smtpusername';
$mail->Password = 'smtppassword';

$mail->AddAddress("email@example.com");
$mail->Subject = "Test 1";
$mail->Body = "Test 1 of PHPMailer.";

if(!$mail->Send())
{
   echo "Error sending: " . $mail->ErrorInfo;
}
else
{
   echo "E-mail sent";
}

As simple as that! :)

PHP: How to Send a PDF File Attachment via E-mail CodeUnit 08 JUN 2011

I’ve moved to the fantastic PHPMailer PHP class to handle all my e-mail send outs for my projects and have thus far been quite impressed by the ease-of-use and robustness of the class. Today I’ll quickly note how you can send an attachment (like a PDF file for example) with a mail send out.

As you can see from the code snippet below, attaching a file is as simple as passing a valid file path to the file to be included to the AddAttachment() function call and then hitting Send().

//create the mail class and fill in all the required settings
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.server.net";
$mail->SMTPAuth = true;
$mail->Username = "username@domain.com";
$mail->Password = "password1";
$mail->From = "username@domain.com";
$mail->FromName = "Software Simian";
$mail->AddAddress("targetguy@domain.com", "Target Guy");
$mail->AddReplyTo("username@domain.com", "Software Simian");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "Subject";
$mail->Body    = "Message";
$mail->AltBody = strip_tags("Message:);

//and now for the actual bit when it comes to adding a file attachment to an e-mail
$mail->AddAttachment("/home/username/fileToUpload/report.pdf");

//and send. Now was that not easy?
if(!$mail->Send()){
    $resultstatus = 'Failed';
}

Couldn’t be any simpler, could it? :)

Related Link: http://phpmailer.worxware.com/

Send Highlighted Text and Link via Email Fast! CodeUnit 09 MAR 2010

Arthur Sabintsev (aka LazyRussion) brings to us the brilliant little Firefox add-on named Email This! which basically allows you to right-click on any selected text on any webpage your are currently browsing and then send the highlight text, title plus link to an email recipient using GMail, Google Apps GMail, Yahoo or even standalone mail clients like Outlook Express or Thunderbird.

The amount of times I want to send an email to myself containing the exact data I just mentioned above for later reference is a lot, so this little add-on is certainly proving to be one hell of an effort saver! :)

To use, simply install as normal and once installed, set the necessary mailer preferences by clicking on the Options button under the Email This! entry on the add-ons page. Once set up, Email This! now becomes usable via either a toolbar entry or a right-click context menu option.

All that, all that is left is now to browse to a page, highlight a passage of text and click send! Brilliant I tell you! :)

Add to Firefox: https://addons.mozilla.org/en-US/firefox/addon/3102

Related Link: http://lazyrussian.com/my-projects/email-this-firefox-extension/