CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Is anyone using AspMail 4.x? To send mail out after insert.

Print topic Send  topic

Author Message
Joe
Posted: 01/27/2005, 9:45 AM

I am trying to send mail when a record is updates. The example uses Aspemail. I converted the AspEmail to AspMail. That was no problme. now I can send static mail out. Example below:
Dim Mailer  
  Set Mailer = Server.CreateObject("SMTPsvg.Mailer")  
  Mailer.FromAddress = "Cherilyn@mydomain.com"  
  Mailer.FromName = "MyDomain.com Claim Dept."  
  Mailer.AddRecipient "","Jmiller@Mydomain.com"  
  Mailer.RemoteHost = "Mydomain.com"  
  Mailer.Subject = "New task for you"  
  Mailer.ContentType = "text/html"  
  Mailer.BodyText = "Claim has been closed"  
     
Mailer.SendMail  
  set Mailer = Nothing

This works perfect. But I want to send data on this claim in the email.

Sort of like this example, but with AspMail.

Set Mailer = Server.CreateObject("Persits.MailSender")   
    Mailer.From = CCDLookUp("email", "employees", "emp_id=" &_  
           DBIntranetDB.ToSQL(CCGetUserID(), ccsInteger), DBIntranetDB)  
    Mailer.FromName = CCDLookUp("emp_name", "employees", "emp_id=" &_  
           DBIntranetDB.ToSQL(CCGetUserID(), ccsInteger), DBIntranetDB)  
    Mailer.AddAddress CCDLookUp("email", "employees", "emp_id=" &_  
           DBIntranetDB.ToSQL(tasks.user_id_assign_to.Value, ccsInteger), DBIntranetDB)  
    Mailer.Host = "mysmtphost.com"  
    Mailer.IsHTML = True  
    Mailer.Subject = "A task was assigned to you"  
    Mailer.Body = "The following task was assigned to you:<br><br>" &_  
           "Task ID: " & CCGetParam("task_id", Empty)& _  
           "<br><br>" & tasks.task_desc.Text  
    Mailer.Send  
    set Mailer = Nothing  

If anyone has a tutorial or some direction that would be great thanks.
Benjamin Krajmalnik
Posted: 01/27/2005, 12:50 PM

Here is an example of using CDO.
I try to stay away from any 3rd party component which needs to be
registered.

This code is on the srver side "on_click()" event

Dim eid, Repnumber, AccountName

AccountName = CCDLookUp("AccountName","Accounts","AccountNumber =
"&CCGetUserID(),DBMyDB)
Repnumber = CCDLookUp("RepNumber","Accounts","AccountNumber =
"&CCGetUserID(),DBMyDB)
eid = CStr(CCDLookUp("Email","Reps","RepNumber = "&RepNumber,DBMyDB))
if eid <> "" then
Dim objCDO, txtmessage

Set objCDO = Server.CreateObject("CDO.Message")

objCDO.To = eid
objCDO.From = Trim(EmailFrom)

txtMessage = "========================================================" &
CHR(13) & CHR(10)
txtMessage = txtMessage & "Request for a Quote from " &AccountName &
CHR(13) &CHR(10)
txtMessage = txtMessage &
"========================================================" & CHR(13)
&CHR(10)
txtMessage = txtMessage & CHR(13) &CHR(10)
txtMessage = txtMessage & (Now) & CHR(13) &CHR(10)
txtMessage = txtMessage & CHR(13) &CHR(10)
txtMessage = txtMessage & "Requested by: "&QuoteReq.RequestedBy.Value &
CHR(13) &CHR(10)
txtMessage = txtMessage & "Requested on: "&QuoteReq.DateRequested.Value &
CHR(13) &CHR(10)&CHR(13) & CHR(10)
txtMessage = txtMessage & "Quote Information " &CHR(13) & CHR(10)
txtMessage = txtMessage & CHR(13) & CHR(10)
txtMessage = txtMessage & QuoteReq.QuoteInfo.Value
txtMessage = txtMessage &CHR(13) & CHR(10)

objCDO.Subject = "Request for Quote"
objCDO.TextBody = txtMessage
objCDO.Send
Set objCDO = Nothing
End If

peterr


Posts: 5971
Posted: 01/27/2005, 1:58 PM

Joe,

Whichever component you decide to use, they are all similar and you'd just need to copy the CCDLookup code from one component to another.
I don't know more than you (I see the AspMail code for the 1st time) but from your example is seems that to specify the "From" email address you would use:
Mailer.FromAddress = CCDLookUp("email", "employees", "emp_id=" &DBIntranetDB.ToSQL(CCGetUserID(), ccsInteger), DBIntranetDB)

And so on with all the other parameters required by AspMail.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Joe
Posted: 01/31/2005, 6:57 AM

Thanks Guys, for all your help and direction.

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.