U

Monday, January 27th, 2025 7:32 PM

Closed

Sending an email from a script.

I should be able to use a blat command within a windows script to send an email?  I get an error that says the smtp server does not like the user name.

Any help is appreciated.  This appears to be a comcast issue.

Here is blat code

:: Gmail settings
set SMTP_SERVER=smtp.comcast.net
set SMTP_PORT=587
set FROM=user@comcast.net
set USERNAME=user@comcast.net
set PASSWORD=userpassword
set TO=email recipient
set SUBJECT="Current Log"
set BODY="This is the log from today"
set ATTACHMENT="D:\Backup.log"

:: Send the email using Blat
%BLAT_PATH%\blat.exe -f %FROM% -to %TO% -subject %SUBJECT% -body %BODY% -attach %ATTACHMENT% -server %SMTP_SERVER% -port %SMTP_PORT% >d:\backup.log

rem %BLAT_PATH%\blat.exe -to %TO% -subject %SUBJECT% -body %BODY% -attach %ATTACHMENT% -server %SMTP_SERVER% -port %SMTP_PORT% -f  %FROM% -u %USERNAME% -pw %PASSWORD%  >dbackup.log

Accepted Solution

Gold Problem Solver

 • 

26.3K Messages

3 months ago

... I get an error that says the smtp server does not like the user name ...

Are you using stunnel or a similar utility to encrypt Blat's data? Most mail servers, including Comcast's, require that connections be encrypted.

Please be aware that there are 2 kinds of responses in this Forum: Replies and Comments. When you Comment on a post by scrolling down to "Comment on this post here...", I am notified of your response. But if you select Reply, I am NOT notified and may not be aware of your response.

(edited)

Expert

 • 

109.9K Messages

3 months ago

Concern moved here to the E-mail help section for assistance.

Official Employee

 • 

790 Messages

3 months ago

@user_y5eiri Thanks for adding a post. We recommend checking to make sure you can log in to your email and send messages from https://xfinityconnect.email.comcast.net/ successfully. Check out this https://www.xfinity.com/support/articles/limitations-on-sending-email guide on email limits, but also the very helpful articles on the right hand side to troubleshoot further. The advice from BruceW is also great, and also a good place to continue for the third party commands. Make sure you reply to their request for more info if needed, or confirm if that was the solution.  

8 Messages

still getting same error.  I can log on directly with no problems.  Have set up stunnel and using the same blat command I previously put in.  any help is appreciated.

8 Messages

3 months ago

also tried putting quotes around the entries in script that had special characters such as password, email address, etc  - no difference - still didn't like sender's name.  SHould this not be an email address?

8 Messages

here is my latest attempt

stunnel configuration setup:


[comcast-smtp]
client = yes
accept = 127.0.0.1:25
connect = smtp.comcast.net:587
verifyChain = yes
CAfile = ca-certs.pem
checkHost = smtp.comcast.net
OCSPaia = yes

Script with blat:

set BLAT_PATH=C:\Bin\blat3224\full

:: Gmail settings
set SMTP_SERVER=smtp.comcast.net
set SMTP_PORT=587
set FROM="s.......@comcast.net"
set SENDER="s........@comcast.net"
set USERNAME="s......@comcast.net"
set PASSWORD="101010101010"
set Recipient="stu........@gmail.com"
set TO="stu.......@gmail.com"
set SUBJECT="Log from Today's Weekly Backup"
set BODY="Hey, Stu, check this out."
set ATTACHMENT="D:\temp\Backup.log"
set profile="comcast-smtp"

:: Send the email using Blat
blat -to %Recipient% -f %SENDER% -subject %SUBJECT% -body %BODY% -attach %ATTACHMENT% -server %SMTP_SERVER% -port %SMTP_PORT% >D:\email.log

get this error

*** Error ***  The SMTP server does not like the sender name.
*** Error ***  Have you set your mail address correctly?

Gold Problem Solver

 • 

26.3K Messages

3 months ago

still getting same error ...

The remmed out blat command line has "-u %USERNAME%" and  "-pw %PASSWORD%" params, but the active line above it does not. Are these stored somewhere so blat can log in to the server?

ETA: Running the command with the -debug parameter might reveal more.

Please be aware that there are 2 kinds of responses in this Forum: Replies and Comments. When you Comment on a post by scrolling down to "Comment on this post here...", I am notified of your response. But if you select Reply, I am NOT notified and may not be aware of your response.

(edited)

8 Messages

thanks...got it working

Official Employee

 • 

2.1K Messages

 

user_y5eiri I'm glad to hear the issue has been resolved. Thanks for keeping us updated and for being part of our Xfinity Community Forums. 

 

I am an Official Xfinity Employee.
Official Employees are from multiple teams within Xfinity: CARE, Product, Leadership.
We ask that you post publicly so people with similar questions may benefit from the conversation.
Was your question answered? Please, mark a reply as the Accepted Answer.tick

8 Messages

2 months ago

I am still having trouble making this work - here is a summary of what I have done so far - this should be much easier but not sure why I am struggling so...thanks for any help you can supply.  

Stunnel.conf contains 

[comcast-smtp]
client = yes
accept = 127.0.0.1:2525
connect = smtp.comcast.net:587
verifyChain = yes
CAfile = ca-certs.pem
checkHost = smtp.comcast.net
OCSPaia = yes

also stunnel.pem has both a private and a certificate that were packaged with it
*********************************
my script modified:  Please note I tried 587 instead of 2525 in both this script and the config file with results staying the same

set BLAT_PATH=D:\Bin\Blat\full
REM Set up email parameters
set SMTP_SERVER=127.0.0.1:2525
set FROM=me@comcast.net
set TO=myotheremail@gmail.com
set SUBJECT=Testme
set BODY=Test
set USERNAME=me@comcast.net
set PASSWORD="mypassword"

d:\Bin\Blat\full\blat -to %TO% -subject "%SUBJECT%" -body "%BODY%" -server %SMTP_SERVER% -f %FROM% -u %USERNAME% -pw %PASSWORD% >>E:\temp\email.log

********************************
Results of a run from e:\temp\email.log

Blat v3.2.24 (build : Feb  9 2022 21:19:39)
64-bit Windows, Full, Unicode

Error: Connection to server was dropped.
Error: Connection to server was dropped.
Error: Connection to server was dropped.
*** Error ***  SMTP server error
Error: Not a socket.
Error: Not a socket.

8 Messages

@user_y5eiri​ 

Problem solved....added a checkHost to stunnel and set to port 587...it works beautifully...thanks to all involved

8 Messages

2 months ago

Problem has been solved..............thanks to all involved

forum icon

New to the Community?

Start Here