Jump to content

Can't send email


Recommended Posts

Hi, could you help me please. I trying using script and getting errors.

$SmtpServer = "smtp.office365.com" ; address for the smtp-server to use - REQUIRED
$FromName = "Me" ; name from who the email was sent
$FromAddress = "email5@*****.com" ; address from where the mail should come
$ToAddress = "timur38@gmail.com" ; destination address of the email - REQUIRED
$Subject = "Mail Test" ; subject from the email - can be anything you want it to be
$Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed
$CcAddress = "" ; address for cc - leave blank if not needed
$BccAddress = "" ; address for bcc - leave blank if not needed
$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
$Username = "email5@*****.com" ; username for the account used from where the mail gets sent - REQUIRED
$Password = "password" ; password for the account used from where the mail gets sent - REQUIRED
$IPPort = 587 ; port used for sending the mail
$ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
;~ $IPPort=465 ; GMAIL port used for sending the mail
;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

"error code 2 description the transport failed to connect to the server"

I also tried to use gmail account.

$SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED
$FromName = "Me" ; name from who the email was sent
$FromAddress = "timur38@gmail.com" ; address from where the mail should come
$ToAddress = "timur@gmail.com" ; destination address of the email - REQUIRED
$Subject = "Mail Test" ; subject from the email - can be anything you want it to be
$Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed
$CcAddress = "" ; address for cc - leave blank if not needed
$BccAddress = "" ; address for bcc - leave blank if not needed
$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
$Username = "timur38@gmail.com" ; username for the account used from where the mail gets sent - REQUIRED
$Password = "Password" ; password for the account used from where the mail gets sent - REQUIRED
$IPPort = 465 ; port used for sending the mail
$ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS
;~ $IPPort=465 ; GMAIL port used for sending the mail
;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

And got

The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available"

Thank you :pirate:

 

Link to comment
Share on other sites

I guarantee you that the scripts you have posted will not cause any errors whatsoever.  Really.  They're just variable declarations.  The issue is most likely with what you're doing after you've declared your variables.  We'll need a more information if you want any actual help.

Link to comment
Share on other sites

Looks like he is calling _INetSMTPMailCOM written by Jos.

Most of the problems I have seen being discussed on this forum are related to wrong parameters or the target mail system not supporting the specified features (SSL etc.).

Search the forum for the error messages and I'm sure you'll get some hits.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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