Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,156
Thanks: 9 times Was thanked: 56 time(s) in 56 post(s)
C# Example // The following example codes demonstrate sending email message using email queue + database
// To get full sample projects, please download and install EASendMail on your machine.
// To run it correctly, please change SMTP server, user, password, sender, recipient value to yours
Code: using System;
using System. Collections. Generic;
using System. Text;
using EASendMail;
namespace mysendemail
{
class Program
{
static void Main( string[ ] args)
{
SmtpMail oMail = new SmtpMail( "TryIt" ) ;
SmtpClient oSmtp = new SmtpClient( ) ;
oMail. From = "test@emailarchitect.net " ;
oMail. Subject = "test email from c# project" ;
SmtpServer oServer = new SmtpServer( "smtp.emailarchitect.net" ) ;
oServer. User = "test@emailarchitect.net " ;
oServer. Password = "testpassword" ;
oMail. Headers. ReplaceHeader( "X-Data-Connection" ,
"Driver={Microsoft Access Driver (*.mdb)}; " +
"Dbq=c:\\easendmail\\easendmail_demo.mdb;Uid=;Pwd=;" ) ;
oMail. Headers. ReplaceHeader( "X-Sql-Select" , "SELECT id, name, address FROM Recipients" ) ;
oMail. Headers. ReplaceHeader( "To" , "\"{$var_srecord:name}\" <{$var_srecord:address}>" ) ;
oMail. Headers. ReplaceHeader( "X-Rcpt-To" , "{$var_srecord:address}" ) ;
oMail. Headers. ReplaceHeader( "X-Sql-OnSentSuccess" ,
"INSERT INTO sentlog ( server, email ) VALUES( '{$var_server}', '{$var_rcptaddr}' )" ) ;
oMail. Headers. ReplaceHeader( "X-Sql-OnSentError" ,
"INSERT INTO errorlog( email, server, errorcode, errordescription )" +
" VALUES( '{$var_rcptaddr}', '{$var_server}', '{$var_errcode}', '{$var_errdesc}' )" ) ;
string s = "Hi {$var_srecord:name}, \r\n" ;
s + = "this sample demonstrates how to send email using email queue.\r\n\r\n" ;
s + = "Your id in database is {$var_srecord:id}.\r\n\r\n" ;
s + = "No matter how many recipients there are, EASendMail " ;
s + = "service will send the email in background.\r\n\r\n" ;
oMail. TextBody = s;
try
{
Console. WriteLine( "start to send email ..." ) ;
oSmtp. SendMailToQueue( oServer, oMail) ;
Console. WriteLine( "email was sent to queue successfully!" ) ;
}
catch ( Exception ep)
{
Console. WriteLine( "failed to send email with the following error:" ) ;
Console. WriteLine( ep. Message) ;
}
}
}
}
Click here to read original topic - full version ... If you have any comments or questions about above example codes, please add your comments here.
Edited by user 10 years ago
| Reason: Not specified
Rank: Newbie
Groups: Registered
Joined: 3/15/2014(UTC)
Posts: 0
Hi Ivan I can see it's possible to set a date and time to send a newsletter, but is it possible to use the database sending approach and specify a date and time for each email? This would be incredibly useful. If it's not possible yet, is it on the cards? Thanks Ivan, Graham
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,156
Thanks: 9 times Was thanked: 56 time(s) in 56 post(s)
I am sorry to say it is not possible to do that in current version. We will consider to add this feature in further version, but not very soon, because it is not so easy to add this.
Forum Jump
EmailArchitect Support
Email Component Development
- EASendMail SMTP Component - .NET Version
- EASendMail SMTP Component - Windows Store Apps
- EASendMail SMTP ActiveX Object
- EAGetMail POP3 & IMAP4 Component - .NET Version
- EAGetMail POP3 & IMAP4 ActiveX Object
Exchange Server and IIS SMTP Plugin
- DomanKeys/DKIM for Exchange Server and IIS SMTP
- Disclaimer and S/MIME for Exchange Server and IIS
EmailArchitect Email Server
- EmailArchitect Email Server (General)
- EmailArchitect Email Server Development
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.