To send e-Mails with Code, Start by knowing how Mail Servers/Protocols Works =).
POP(3)/IMAP/SMTP = Protocols.
Edit~
Okay ; I admit my answer wasn't convenient, But You give me that feeling ; Let me explain myself.
I often see you post thingys about new thingies and never you trying to go far/further in something, Only ask for basic things you don't know and overview without trying to understand, And In my opinion of coding this is not really a good thing to do if you want to learn instead of Paste...