SMTP Email: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
'''Creating a Com Interface for SMTP Email''' | =='''Creating a Com Interface for SMTP Email'''== | ||
'''''Why SMTP?''''' | '''''Why SMTP?''''' | ||
Line 25: | Line 25: | ||
Create a simple one-view test application. On the view you will need the following form controls and name the form objects as indicated: | Create a simple one-view test application. On the view you will need the following form controls and name the form objects as indicated: | ||
· The SMTP host address - oHost | · The SMTP host address - oHost | ||
· From address - oFromAddr | · From address - oFromAddr | ||
Line 34: | Line 35: | ||
In addition, take the following steps | In addition, take the following steps | ||
# Add “Use aspemail.pkg” to the top of your code, outside the view itself | |||
# Add one button to the view and change the label to “Send” | |||
# Add the following object to the top of the view, anywhere inside or outside of the view itself: | |||
Object oComMailSender is a cComMailSender | Object oComMailSender is a cComMailSender | ||
End_Object | End_Object | ||
# We need to create the object | |||
Send CreateComObject to oComMailSender | Send CreateComObject to oComMailSender | ||
Line 57: | Line 58: | ||
Inside the OnClick event in the “Send” button added above, add the following code: | Inside the OnClick event in the “Send” button added above, add the following code: | ||
String sAttach sName | |||
Integer iRC | Integer iRC | ||
Set ComUserName of oComMailSender to "YourEmailLoginID" | |||
Set ComPassword of oComMailSender to "YourEmailLoginPassword" | |||
Set ComHost of oComMailSender to (Value(oHost)) | |||
Set ComFrom of oComMailSender to (Value(oFromAddr)) | |||
Set ComSubject of oComMailSender to (Value(oSubject)) | |||
Set ComBody of oComMailSender to (Value(oMessage)) | |||
Send ComAddAddress to oComMailSender (Value(oToAddr)) sName | |||
Get Value of oAttachment to sAttach | |||
If (trim(sAttach) <> "") Begin | |||
Send ComAddAttachment to oComMailSender sAttach | |||
End | |||
Get ComSend of oComMailSender "" to iRC | |||
'''''SMTP Host''''' | '''''SMTP Host''''' | ||
To determine who your SMTP host is, do the following | To determine who your SMTP host is, do the following | ||
# Bring up your mail client. For Outlook or Outlook Express… | |||
# Click on Tools | |||
# Click Accounts | |||
# Select the account for your provider | |||
# Click Properties | |||
# On the “Server” tab use the entry from “Outgoing mail (SMTP)” | |||
'''''Operation''''' | '''''Operation''''' |