This link shows a DotVariable - just what I'm looking for - but it's V11.
Can I get it to work in V10.5? It is unformatted on the Wiki as well BTW
http://wiki.alphasoftware.com/DotNet...+Send+an+email
'most commonly used parameters
dim recipient as C = "(your recipient here, must be one valid email)"
dim subj as C = "(your subject line here)"
dim body as C = "(your email body here)"
dim isHtml as L = .T. '.T. if body is HTML, otherwise .F.
dim FileAttachment as C = "(your attachment file path here)"
dim CC as C = "(your CC here, must be one valid email)"
dim Bcc as C = "(your BCC here, must be one valid email)"
'If you want multiple recipients, CCs, or BCCs, you need to write FOR or FOR EACH loops
' to add them
'parameters that are often static for a web site
dim sender as C = "(your sender here, must be one valid email)"
dim EmailServer as C = "smtp.gmail.com" 'put your server here
dim EmailPort as N = 587 'usually 25 (plain) or 465 (SSL/TLS). 587 for GMail TLS.
dim isSSL as L = .T. '.T. if SSL/TLS, .F. if not
dim EmailUser as C = "(your user ID here, often the same as the sender)"
dim EmailPassword as C = "(your email password here)"
dim msg as System::Net::Mail::MailMessage = new System::Net::Mail::MailMessage() 'this is where the error occurs.
msg.To.Add(recipient)
msg.From = new System::Net::Mail::MailAddress(sender)
msg.Subject = subj
msg.Body = body
msg.BodyEncoding = System::Text::Encoding::UTF8
msg.IsBodyHtml = isHtml
msg.Priority = System::Net::Mail::MailPriority::Normal
dim addrCC as System::Net::Mail::MailAddress = new System::Net::Mail::MailAddress(CC)
msg.CC.Add(addrCC)
dim addrBcc as System::Net::Mail::MailAddress = new System::Net::Mail::MailAddress(Bcc)
msg.Bcc.Add(addrBcc)
'Uncomment the next line if you want to have a file attachment
'msg.Attachments.Add(new System::Net::Mail::Attachment(FileAttachment))
dim MailClient as System::Net::Mail::SmtpClient = \
new System::Net::Mail::SmtpClient(EmailServer,EmailPort)
MailClient.EnableSsl = isSSL
MailClient.UseDefaultCredentials = .F.
MailClient.Credentials = new System::Net::NetworkCredential(EmailUser, EmailPassword)
MailClient.Send(msg) 'this does the actual sending of email
msg.Dispose() 'clean
Can I get it to work in V10.5? It is unformatted on the Wiki as well BTW
http://wiki.alphasoftware.com/DotNet...+Send+an+email
'most commonly used parameters
dim recipient as C = "(your recipient here, must be one valid email)"
dim subj as C = "(your subject line here)"
dim body as C = "(your email body here)"
dim isHtml as L = .T. '.T. if body is HTML, otherwise .F.
dim FileAttachment as C = "(your attachment file path here)"
dim CC as C = "(your CC here, must be one valid email)"
dim Bcc as C = "(your BCC here, must be one valid email)"
'If you want multiple recipients, CCs, or BCCs, you need to write FOR or FOR EACH loops
' to add them
'parameters that are often static for a web site
dim sender as C = "(your sender here, must be one valid email)"
dim EmailServer as C = "smtp.gmail.com" 'put your server here
dim EmailPort as N = 587 'usually 25 (plain) or 465 (SSL/TLS). 587 for GMail TLS.
dim isSSL as L = .T. '.T. if SSL/TLS, .F. if not
dim EmailUser as C = "(your user ID here, often the same as the sender)"
dim EmailPassword as C = "(your email password here)"
dim msg as System::Net::Mail::MailMessage = new System::Net::Mail::MailMessage() 'this is where the error occurs.
msg.To.Add(recipient)
msg.From = new System::Net::Mail::MailAddress(sender)
msg.Subject = subj
msg.Body = body
msg.BodyEncoding = System::Text::Encoding::UTF8
msg.IsBodyHtml = isHtml
msg.Priority = System::Net::Mail::MailPriority::Normal
dim addrCC as System::Net::Mail::MailAddress = new System::Net::Mail::MailAddress(CC)
msg.CC.Add(addrCC)
dim addrBcc as System::Net::Mail::MailAddress = new System::Net::Mail::MailAddress(Bcc)
msg.Bcc.Add(addrBcc)
'Uncomment the next line if you want to have a file attachment
'msg.Attachments.Add(new System::Net::Mail::Attachment(FileAttachment))
dim MailClient as System::Net::Mail::SmtpClient = \
new System::Net::Mail::SmtpClient(EmailServer,EmailPort)
MailClient.EnableSsl = isSSL
MailClient.UseDefaultCredentials = .F.
MailClient.Credentials = new System::Net::NetworkCredential(EmailUser, EmailPassword)
MailClient.Send(msg) 'this does the actual sending of email
msg.Dispose() 'clean
Comment