Юрий
Новичок
- Сообщения
- 82
- Репутация
- 3
День добрый. При версии 10.1 всё работало, обновился - ошибка.
Код функции:
Код функции:
Код:
Func SendAnEmail()
Local $ToAdress$SmtpServer, $FromName, $FromAddress, $Subject, $Body, $Username, $Password, $IPPort, $ssl
$SmtpServer = "smtp.yandex.ru"
$FromName = "Name"
$FromAddress = "[email protected]"
$Subject = "subj"
$Body = "body"
$Username = "username"
$Password = "pass"
$IPPort = 465
$ssl = 1
Local $objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $FromName & '" <' & $FromAddress & ">"
$objEmail.To = $ToAddress ; <<< Ошибка здесь: missing separator character before keyword.
; если написать $objEmail.To1 - ошибки нет, но и письмо-то не отсылается
$objEmail.Subject = $Subject
$objEmail.HTMLBody = $Body
$objEmail.AddAttachment("f.jpg")
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $SmtpServer
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $Username
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $Password
If $ssl Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
$objEmail.Configuration.Fields.Update
$objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High"
$objEmail.Fields.Update
$objEmail.Send
$objEmail = ""
EndFunc