-1

Is this an valid example from Python's smtplib? How, from this example, would one send email without giving the password?

import smtplib

def prompt(prompt):
    return raw_input(prompt).strip()

fromaddr = prompt("From: ")
toaddrs  = prompt("To: ").split()
print "Enter message, end with ^D (Unix) or ^Z (Windows):"

# Add the From: and To: headers at the start!
msg = ("From: %s\r\nTo: %s\r\n\r\n"
       % (fromaddr, ", ".join(toaddrs)))
while 1:
    try:
        line = raw_input()
    except EOFError:
        break
    if not line:
        break
    msg = msg + line

print "Message length is " + repr(len(msg))

server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
CDspace
  • 2,639
  • 18
  • 30
  • 36

1 Answers1

-1

You can send emails without using a password assuming the server configuration allow that.

Pierre Barre
  • 2,174
  • 1
  • 11
  • 23