Jump to content

SMTP port and ssl


 Share

Recommended Posts

Hi,

I have this e-mail script but now I want to add the option to change it's port to 465 and enable SSL so I can use it for gmail, anyone knows how?

If FileExists ("Glider.log") Then
$file = FileOpen("Glider.log", 0)
Else
$file = ""
EndIf
$chars = FileRead($file)
FileClose($file)

$smtpserver = ""
$smtpuser = ""
$smtppass = ""
$e_Sender = ""
$e_Recipient = ""
$e_Subject = "hello"
$e_Text = "hoi"
$e_File = ""

SendEmail($e_Sender,$e_Recipient,$e_Subject,$e_Text,$e_File)
; use the function here!

Func SendEmail($e_Sender, $e_Recipient, $e_Subject, $e_Text, $e_File)
    $objMessage = ObjCreate("CDO.Message")
    With $objMessage
        .Subject = $e_Subject
        .Sender = $e_Sender
        .From = $e_Sender
        .To = $e_Recipient
        .TextBody = $e_Text
     ;.HtmlBody = $e_Text; uncomment to send a HTML mail and comment line above
     ;.AddAttachment = $e_File ; <== I REMOVED THIS as we don't have an attachment
    EndWith
    With $objMessage.Configuration.Fields
        .Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $smtpserver
        .Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        .Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $smtpuser
        .Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $smtppass
        .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
        .Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
        .Update
    EndWith
    $objMessage.Send
    Return
    
EndFunc;==>SendEmail

EDIT: I forgot to censor my password and username :)

Edited by tom13
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...