New topic: 

smtp email

<http://forums.realsoftware.com/viewtopic.php?t=38068>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        rlsdata          Post subject: smtp emailPosted: Fri Mar 11, 
2011 12:41 pm                         
Joined: Mon Feb 21, 2011 4:41 pm
Posts: 5                I hope to get some help with this issue:
Using the email example I modified the code in my application to read email 
values from an access table and send the email out.

Code:  dim db as ODBCDatabase
  db = new ODBCDatabase
  
  db.DataSource = "Driver={Microsoft Access Driver (*.mdb, *.accdb)}; 
Dbq=c:\360\360.accdb;"
  
  if db.connect then
  //MsgBox "connection is good"
  else
  MsgBox "connection failed"
  end if
  
  //set up rs for reading outbound emails
  
  dim rs as RecordSet
  '
  dim sql as string
  sql = "SELECT * FROM tblEmailOutbound"
  
  rs = db.SQLSelect(sql)
  
  dim mail as emailMessage
  dim file as emailAttachment
  dim i as integer
  dim s as string
  
  rs.MoveFirst
  do until rs.eof
  
  // set up the socket
  
  socket1.address = rs.Field("SMTPHost").StringValue
  socket1.port = 25
  socket1.username = rs.Field("SMTPUser").StringValue
  socket1.password = rs.Field("SMTPPass").StringValue
  
  socket1.connect
  
  // populate the email message
  mail = new emailMessage
  mail.fromAddress = rs.Field("EmailFrom").StringValue
  
  mail.subject = rs.Field("Subject").StringValue
  
  
  mail.bodyPlainText = rs.Field("EmailBody").StringValue
  //mail.bodyHTML = htmlFld.text
  
  mail.headers.appendHeader "X-Mailer","360 Email"
  mail.AddRecipient rs.Field("EmailTo").StringValue
  mail.AddCCRecipient rs.Field("EmailCC").StringValue
  mail.AddBCCRecipient rs.Field("EmailBCC").StringValue
  
  
  
  // add attachments
  if rs.field("Attachment").value <> "" then
  file = new emailAttachment
  file.loadFromFile getFolderItem( rs.field("Attachment"))
  mail.attachments.append file
  end
  
  // send the email
  
  socket1.messages.append mail
  progressBar1.visible = true
  socket1.sendMail
  
  
  rs.movenext
  loop
  
  db.Close
  
  
  msgbox "Mail Sent!"
  quit
  
  


If I step though the code with a breakpoint, all the values are valid using the 
recordset...

Not sure why the email appears to not be sending. I don't get any errors though.

The email example sends just fine.      
_________________
Ryan S.

"Make someone other than yourself your mission in life." J. Klunder - 2009  
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to