In a message of Wed, 17 Jun 2015 02:05:49 +0100, Oliver Mercer-Deadman writes: >Hi I am a complete newbie but am hoping to learn some python for a >particular project. Before I hurl myself in I would like to know if a key >element is going to be possible. > >I will need to be able to use a variable as the username in an email >address. E.G. > >username = Input("Enter Something: ") > >Then later when sending email with SMTP >to_addr = 'usern...@mycompany.com' > >I realise that it is probably not correct, I am only in the foothills, but >in principal can it be done? > >Thanks, >Ozzy
You can do this. Works great. Note, you will want to be using the smtplib that is part of the Python standard library and not write all of the code for talking to SMTP yourself. Somebody else has already done this for you. Interesting tutorial here: http://pymotw.com/2/smtplib/ But be warned, this uses Python 2 syntax, not Python 3. Laura _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor