Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending mails using NMSMTP

Status
Not open for further replies.

LastCyborg

Programmer
Feb 7, 2003
256
MX
Days ago I saw that somebody was trying to send mails, and he said that chose SMTP, I tried to do the same, but I have some problems.

First, I don't know to much about Internet applications, so what should I put in the host property?

Can I make that when the user choose to send a mail my application get connected and sends the E-mail without using the Outlook?

Can anybody give me an example?

--- LastCyborg ---
 
In fact i have the sample file that comes with the BCB, but when I run it I don't know what to put in the host edit.

--- LastCyborg ---
 
Your basic email system is as follows:



HOST -------------- HOST ------------- HOST
|
--------------------
| |
USER USER

There are two servers involved, can be on the same host machine. You have SMTP (Simple Mail Transfer Protocol) and POP3 (Post Office Protocol version 3). SMTP is used to send (relay) mail from one computer to another. POP3 is a protocol used for a USER to connect to a HOST and download their mail.

Each user has to connect to both host servers, an IP address to the server that is running the POP3 email software, and an IP address to the server that allows that user to send (relay) mail via SMTP.

Some SMTP servers require authentication, some do not. We refer to the ones that do not as Open Relay servers. They openly allow relaying of email without any authorization.

If you query the outlook account information for each email account setup under it, you will see an incoming and outgoing server. You will also see a checkbox under "More Settings" that says "My outgoing server requires authorization." This will provide you will all the information you need to run tests with your software. You should already know your user name and password.

When you design your software, for modularity (if you choose), you will want to have a settings dialog that allows the user to change their host(ip address or mail.whatever.com with some components), their username and password, and their authentication settings for relaying mail. You will want to save this information somewhere, perhaps file or registry. Just remember you have a password in there. So either don't save the password and make them retype it everytime, or encrypt it. There are some threads on encryption that would be very helpful in this forum from a few weeks ago.

To actually send a test mail, just drop the SMTP component on the form, set it's host property, username and password if required, the TO address, the TO Name, the Subject, the FROM address, the FROM name, and the REPLY TO address and name.

Then make a button and edit box on the form. When you press the button, set the "Body" property of the SMTP component to the edit box's text. If you have to create a Message object, set it up according to the above info.

Call the "Connect" function or equivilent function from the SMTP component. Next, after connected, call the "Send" or equivilent function from the SMTP component. You may be required to pass in the message that will be sent. View the help file. Create the message, then pass it into the function. That depends on which component you use.

Good luck,
Chris
 
You cannot use any host you want. You have to have an account with the host you want to send mail through. The only hosts you can use freely are open relay hosts, as I described before. Those hosts do not require authentication. You won't find many out there as they are shunned. They allow people to just forward viruses and spam mail out. You will have to use the host that you currently use for your mail in Outlook.

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top