You can gather the email name from
emailname_ and the email id via
_emailid personalization string. This will directly pull in the values from the current email and will not require any lookups or data manipulation.
var emailid = _emailid
var emailname = emailname_
<p>This is the name of the email: %%emailname_%%</p>
<p>This is the id of the email: %%_emailid%%</p>
If it is after the email was sent, I would just use a SQL Query to the Job Data View which will provide the emailid.
SELECT jobid, emailid
WHERE jobid = 8675309
As a last resort, you CAN use ampscript to gather it via a lookup to the Job Dataview, but I do not recommend it as this will greatly increase processing time and can lead to errors or time outs on your email.
SET @emailidRows = LOOKUPROWS("_Job", "JobID", 8675309 )
SET @Row = ROW(@emailidRows,1)
SET @emailid = FIELD(@Row,"EmailID")