Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Code snippet
'private void cmdSend_Click(object sender, System.EventArgs e)
{
try
{
CDO.Message oMsg = new CDO.MessageClass();
CDO.Configuration oConfig = new CDO.ConfigurationClass();
ADODB.Fields oFields = oConfig.Fields;
StringBuilder MailString = new StringBuilder();
int x = 1000;
// Set up configuration to send to remote SMTP server
oFields["https://schemas.microsoft.com/cdo/configuration/sendusing"].Value = CDO.CdoSendUsing.cdoSendUsingPort;
oFields["https://schemas.microsoft.com/cdo/configuration/smtpserver"].Value = txtSMTPServer.Text;
oFields["https://schemas.microsoft.com/cdo/configuration/smtpserverport"].Value = 25;
oFields.Update();
// Apply the configuration object to the message object
oMsg.Configuration = oConfig;
// Make the root bodypart "quoted-printable"
oMsg.BodyPart.ContentTransferEncoding = "quoted-printable";
// Set up the message
oMsg.From = txtFrom.Text;
oMsg.To = txtTo.Text;
oMsg.Subject = txtSubject.Text;
MailString.Append("<table>");
while (x > 0)
{
MailString.Append("<tr><td>this is a test, </td></tr>");
x--;
}
MailString.Append("</table>");
oMsg.HTMLBody = MailString.ToString();
oMsg.Send();
txtOutput.Text = "Message Sent!";
MailString = null;
oFields = null;
oConfig = null;
oMsg = null;
}
catch(Exception MyException)
{
txtOutput.Text = MyException.Message;
}
}