Sign in to follow this  
Followers 0
timur38

Can't send email

3 posts in this topic

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:

 

Share this post


Link to post
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.

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0