Round TLRSWP Logo TLRSWP Banner Image
Home
News
Products
Updates
Support
EmailDLL
Manual
FAQ
General
Install
Integrate
Class Use
DLL Use
Messages
Debug
Debug
DocBox
Contacts
Company
Site Map

EmailDLL Creating and Sending Messages FAQs

Click here for more information on EmailDLL This page has answers to FAQs dealing with Creating and Sending Messages. Included are some very handy tips for using email better. The other categories available are: General Information, EmailDLL Installation, Integration with your application, Email Class, Direct DLL Access, and Troubleshooting.
 

My email won't send. What's wrong?
The most frequent cause is an error in either the server address, or in specifying the "From" account.

Check the error messages present in the debugging log window, and returned to your application. If they indicate the SMTP server could not be found, then the name is likely wrong. Using a DOS command window, "ping" the server with a command like:

ping smtp1.mycompany.com
Of course, replace smtp1.mycompany.com with the mail server you tried to use with the EmailDLL. If the server couldn't be found, then you should find the correct name of the server.

If the errors returning to your program indicate a communications error, this might indicate that the SMTP server is refusing your email. Check the "From" address you're giving. In order to cut down on "spamming", many SMTP servers are being configured to accept email only from specific users on specific machines. If you're giving a From: address of an unknown user, the server may be refusing your requests.

If the server appears to be accepting the request, but some other communications error occurs, then you may need to increase the number of attempts. You can do this with either the Email.SetMaxAttempts() method, or the equivalent direct-access operator, val_SetMaxAttempts. Setting this above the default value of three may help if your SMTP server handles a lot of email traffic.

There are other things which prevent your email from being sent. These include not giving any recipients, not setting the From: header, etc. Carefully scrutinize the error codes and messages returned by EmailDLL. If you have trouble deciphering their meaning, send us email, and we'll try to explain it more clearly.

Why does my application sometimes slow down?
If you experience long delays while sending email, it's likely because your SMTP server is responding slowly.

One limitation of the Windows DLL implementation is that a DLL cannot trigger an event in the main program. So, in order to get complete status back from an email message send command, the EmailDLL must wait until the send operation either fails or completes successfully.

If you send large messages, a lot of messages, or if your SMTP server is heavily loaded, you will experience delays while the email is transmitted to the SMTP server.

Can EmailDLL handle MIME attachments?
This version of EmailDLL can only handle MIME encodings that you construct "manually". That is, you have to set the header lines indicating the MIME type, and include the MIME encapsulation and separators through the Email.AddMessageText() methods. No automatic methods for using MIME types are provided at this time.

MIME attachments are planned for a future EmailDLL release.

How do I send HTML mail?
Yes, you can send web-style, formatted text and graphics using EmailDLL. It's not built-in, but using the Email.AddOtherHeaders() method allows you to accomplish the beautiful and beastly in your emails.

First, credit where it is due. The techniques behind this feat were adapted from information provided by Wired Magazine's online Web designer service, WebMonkey. Thanks mightily to them.

And now, some cautions. At the time this is being written (March, 1998), not all email clients can handle HTML formatted messages. Further, not all users can handle HTML either; some may flame you. The email clients that do support HTML messages don't support all tags, most notably frames, page anchors (<A NAME=...>), or custom backgrounds.

Probably the biggest drawback to HTML email is download time. At this time, inline images aren't supported, so images are downloaded to the user's computer when the email is displayed, not when it is first received by their mailbox. If you include references to large images in your email, your recipients will have to wait to download those images before they can fully appreciate the email you've sent them.

So, you've decided to proceed, ignoring the cautions above. Good for you. Basically, all you have to do is add the appropriate headers so your email text is seen as HTML and not plain text. You also have to indicate what MIME version you're using, etc. Below is an example:

this.parent.EM = new Email();
this.parent.EM.Create(this);
....
with (this.parent) {
  EM.ClearOtherHeaders();
  EM.AddOtherHeader('MIME-Version: 1.0');
  EM.AddOtherHeader
    ('Content-Type: text/html; charset=us-ascii');
  EM.AddOtherHeader
    ('Content-Transfer-Encoding: 7bit');
  EM.SetServer('smtp.mysite.com');
  ....
  EM.AddMessageText('<body>');
  EM.AddMessageText('<center>');
  EM.AddMessageText('<font face=\'Arial,Helv\' size=3');
  EM.AddMessageText
    ('<img src="http://www.mysite.com/pic/tomato.gif">');
  EM.AddMessageText('<P>');
  EM.AddMessageText
    (<A HREF=http://www.mysite.com>Click Here</A>');
  ....
  EM.AddMessageText('</font></body>');
  var ErrorStatus = EM.SendMessage();
  ...
  EM.Free();
}
                

As you can see, there are several changes from a normal text email message. The header lines (in the order they appear above) set the MIME encoding version, and then the content type. Be sure you include both text/html and the character set in that header line. The next header line indicates that the data is to be transferred as 7-bit standard ASCII.

In the body of the message, you should format it like any other HTML page. The most notable difference is that all URL references must be absolute. The user's email client has no knowledge of the base URL, so it can't resolve relative paths to links or images. Because of this, all links and images must contain full URL paths. And, the pictures you reference must be there when the user loads the page. For this reason, including pictures from a database isn't practical unless your database can serve image references directly to the HTTP server. IntraBuilder can only do this for an active session, which would not be present with an email message.

While not precisely required, we recommend wrapping your email message HTML text in open and close "body" tags.

Once you've composed the message headers and text, simply transmit with message with the Email.SendMessage() command. Make sure to watch for errors here, since this is where most of them will show up.

How much text can I put in an email message?
The only limit to the amount of text is the practical limit of your SMTP server, the various mail relays, and the recipient's mailbox capacity. Many SMTP mail relays have a limit of one or two megabytes per message. The internal data structures of EmailDLL are limited to around 2GB, so you should not have any problem with this.

How can I include a signature file?
A signature file is usually a pre-created piece of text that is added at the end of an email message. It often contains standard information about the sender, and the company they work for.

To add a signature file to email messages sent from your IntraBuilder applications, simply use the Email.SetMessageFile() method. Provide the full path to the signature file, and it will be added after the message text you've added.

The Email.SetMessageFile() command only keeps the last file specified. If you call this method more than once for a single email message, only the last-specified file will be used.

Should I set the time and date of my messages?
Setting the Date: header field is not usually necessary. The SMTP server will add the correct Date and Time in the standard format when it recieves a message with no Date: header line.

If you want a special date/time formating, or you want to specify some specific time, then use the Email.SetDate() method. Just be careful to ensure your recipients will be able to sort your messages in their email client.

How should I choose the mail server and From: account?
The server name you use must be a standard Simple Mail Transfer Protocol (SMTP) server. Remember, this is the outgoing email server. It may have a different name than the Post Office Protocol (POP) server from which you receive your email.

Your application should have an email address assigned to it that reasonably represents it's function. For instance, a financial reporting system that sends email as "Judy Smith" won't be recognized by the recipients. So, have your systems administrator assign an email address for your application.

Now that your application has an email address, your choice of SMTP server may be limited by which server will accept email originating from that user name. Work with your systems administrator to ensure your application's email will be readily accepted having the From: address in use.

Can I add multiple email addresses with a single function call?
Yes. For all but one of the methods requiring an email address, you can supply more than one address. The one method not accepting multiple address is the From: header, set with the Email.SetFrom() method. You can only supply a single email address to that method. No specific error is returned, but your SMTP email server may refuse to send the email.

To specify multiple recipients in the To:, ReplyTo:, CC:, and BCC: fields, you can use two techniques. You can supply multiple addresses by separating the addresses with commas: "jimmie@mycompany.com, johnny@myschool.edu". You can also call the method more than once. You can use either technique, or a combination of the two.

How do I make "real" names to appear for the recipients?
You can easily have people's real names show up in their email addresses. For each email address, first put the real name. If the address contains spaces, it's usually best to put double quotes around it. Don't use single quotes, because they may cause trouble if the name contains an apostrophe. For example, 'O'Malley' would cause problems, but "O'Malley" is acceptable.

After the real name, include the email address, enclosed in angle brackets: '<' and '>'.

Here are some examples:

    Jimmie <jj@mycompany.com>
    "Jimmie Johannsen" <jj@mycompany.com>
    "Jimmie's Scandinavian Tours" <jj@mycompany.com>
                

To include multiple full names in a single method call, simply separate the names with commas.

How can I get bounced emails to go to a real person?
When an SMTP server encounters an error transferring an email message, the default is to return the message to the sender specified on the From: header line. The SMTP server also includes some indication of the problems it encountered.

Since your IntraBuilder application is likely to have a From: name representing the application and not a real user, returned messages might never get noticed until they fill up a disk somewhere.

SMTP servers can be instructed to direct errors to another email address with the Error: header line. Use the Email.AddOtherHeader() method to include a real person's email address. Any errors that occur with the messages will be sent to that user.

How can I make user replies go to a real person?
When someone reads an email message and performs a "Reply" to the message, the default action is to send that reply to the email address named in the From: header line.

Since your IntraBuilder application is likely to have a From: name representing the application and not a real user, replies might never get noticed until fill up a disk somewhere.

If you want the replies to be sent to another person, simply set the ReplyTo: header line with the Email.SetReplyTo() method.

 


Copyright 1998, TLR Software Publishing
Questions? Comments? Invective?