SendAt

The SendAt method specifies when to send the message (available in Version 2.0 and above).

Syntax

SendAt(when)

Parameters

when
Specifies the time at which the message will be sent. Eg (now + 1) will be this time tomorrow. See example.

Return Values

Returns nothing.

Example

The following two files collect an email address, and send 3 messages. The first message sent straightaway, the second after 6 minutes, the third after 12 minutes. In the real world you would not normally send messages so quickly, but it is better here to see the example working.



GetEmail.htm
<HTML> <body bgcolor=white> <TITLE>Get EMail</TITLE> <FORM METHOD="GET" ACTION="signMeUp.asp"> <PRE> Please enter your email address: <INPUT SIZE=30 NAME="recipient" MAXLENGTH=200> </PRE> <INPUT TYPE=submit VALUE=" Sign Me Up "> </FORM> <P> </HTML></BODY> </PRE>
signMeUp.asp
<HTML> <HEAD> <TITLE>Send Mail</TITLE> </HEAD> <body BGcolor=#FFFFFF> <% Set mailer = Server.CreateObject("ocxQmail.ocxQmailCtrl.1") %> <CENTER> <H2> Send Mail </H2> </CENTER> <P> <% mailServer = "mail.server.com" fromName = "Kevin" fromAddress = "kevin@server.com" 'priority = "Low" returnReceipt = "" recipient = Request.QueryString("recipient") result = mailer.PreScreenEmailAddress(recipient) If "" <> result Then response.Write("Email address is not ok, because the email address " & result) response.End End if toAddressList = recipient 'ccAddressList = "kflick@netcom.com" 'bccAddressList = "sales@flicks.com" 'attachmentList = "z:\zip\addurl.zip" 'attachmentList = attachmentList & "," 'attachmentList = attachmentList & "c:\sounds\thisIsGreatMan.wav" whenToSend = now ' redundant - the default is now mailer.SendAt(whenToSend) messageSubject = "Test ocxQmail 1 - TRASH ME" messageText = "Text 1 of test of ocxQmail - this is the first message." & vbCrLf & "Scheduled for sending at " & whenToSend result = mailer.Q(mailServer, _ fromName, _ fromAddress, _ priority, _ returnReceipt, _ toAddressList, _ ccAddressList, _ bccAddressList, _ attachmentList, _ messageSubject, _ messageText) response.Write("<BR> Sent mail, scheduled for " & whenToSend & "<BR>Message is <br>" & messageText & "<P>") whenToSend = now + (1/240) ' one day divided by 24 divided by 10 - Six Minutes time mailer.SendAt(whenToSend) messageSubject = "Test ocxQmail 2 - TRASH ME" messageText = "Text 2 of test of ocxQmail - this is the second message." & vbCrLf & "Scheduled for sending at " & whenToSend result = mailer.Q(mailServer, _ fromName, _ fromAddress, _ priority, _ returnReceipt, _ toAddressList, _ ccAddressList, _ bccAddressList, _ attachmentList, _ messageSubject, _ messageText) response.Write("<BR> Sent mail, scheduled for " & whenToSend & "<BR>Message is <br>" & messageText & "<P>") whenToSend = now + (1/120) ' one day divided by 24 divided by 5 - Twelve Minutes time mailer.SendAt(whenToSend) messageSubject = "Test ocxQmail 3 - TRASH ME" messageText = "Text 3 of test of ocxQmail - this is the third message." & vbCrLf & "Scheduled for sending at " & whenToSend result = mailer.Q(mailServer, _ fromName, _ fromAddress, _ priority, _ returnReceipt, _ toAddressList, _ ccAddressList, _ bccAddressList, _ attachmentList, _ messageSubject, _ messageText) response.Write("<BR> Sent mail, scheduled for " & whenToSend & "<BR>Message is <br>" & messageText & "<P>") %> <% If "" = result Then %> <P> Mail has been queued. <% Else %> <P>Mail was not queued, error message is <H2> <%= result %> </H2> <% End If %> <P> <HR> <P> <EM><B> <a href=a href="/">Flicks Software</a>. </B> </EM> </FONT> </BODY> </HTML>

Applies To

ocxQmail ASP Component