send mail via script
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
send mail via script
Good Day,
I try send mail via script, but I get error.
def SendEmail(Message): try: useSSL = 'True' schema = "http://schemas.microsoft.com/cdo/configuration/" mConfig = Sys.OleObject["CDO.Configuration"] mConfig.Fields.Item[schema + "sendusing"] = 2 mConfig.Fields.Item[schema + "smtpserver"] = outlook.office365.com mConfig.Fields.Item[schema + "smtpserverport"] = 587 mConfig.Fields.Item[schema + "sendusername"] = MyEmailAddress mConfig.Fields.Item[schema + "sendpassword"] = MyEmailPassword mConfig.Fields.Item[schema + "smtpauthenticate"] = 1 mConfig.Fields.Item[schema + "STARTTLS"] = True mConfig.Fields.Item[schema + "smtpconnectiontimeout"] = 30; mConfig.Fields.Update() mMessage = Sys.OleObject["CDO.Message"] mMessage.Configuration = mConfig mMessage.From = MyEmailAddress mMessage.To = MyEmailAddress mMessage.Subject = 'TestComplete Result' mMessage.HTMLBody = Message mMessage.Send(); except Exception as exp: Log.Error('E-mail cannot be sent', str(exp)) return False Log.Message('Message was successfully sent') return True def test (): SendEmail('Hi')
Wht is wrong in my code?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @paarmann-ara,
I agree with the previous replies that this error is related to the email settings. Please check all of them one more time, especially because you use the Microsoft Exchange email address. You can start with this:
https://docs.microsoft.com/en-us/exchange/troubleshoot/connecting-to-the-service/incorrect-settings
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good day!
after oppening the Port I get thise Error: (confused):smileysad:
'The server has rejected the sender address. The server answer is: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [AM3PR07CA0054.eurprd07.prod.outlook.com] '
but I can send mail with other Programs
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @paarmann-ara,
I've found this solution. Please check if the settings listed there help you.
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@TanyaYatskovskaThank you but not working. I use a Test Tools. please see a Photo.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update, Now I get this Error:
Error: SMTP protocol error. 530 5.7.0 Must issue a STARTTLS command first. Failed to send messageConnecting to mail server.
Maybe sombody have Idee
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Something that sounds quite similair was asked and replied here locally. The problem was with the .Net SMTP client code for gmail, but maybe the same case exists for Microsoft as well.
Question:
I have an issue when trying to send an email from a customer’s email account from G Suite.
I receive an exceptions with the following message returned:
“System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at”
Yes, the message end abruptly for some reason.
Found solution:
The issue was resolved.
The reason of access deny was that app-specific passwords work only when two-factor authentication is enabled, and for this account two-factor authentication was disabled today some time ago. So, my app password was not valid anymore.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@AlexKarasHi and thanks for your Reply.
in my case, that appear because the Hosting department blockiert the port 25. Now the port is open.
I can send mail with other program but just with TC, I get this error. 😞
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good day,
After days and days, I have find a solution for this problem.
The CDO do not support TLS therefor this problem apear in my Case. I use another codes from this Link
https://www.rosettacode.org/wiki/Send_email#Python
maybe that is better to attache that codes in TC's help. 🙂
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your investigation!
I'm sure the solution you've found will help many users. Thanks for sharing it.
Tanya Yatskovskaya
SmartBear Community and Education Manager

- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »