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.
e.g.
%%[
var emailid = _emailid
var emailname = emailname_
]%%
or <p>This is the name of the email: %%emailname_%%</p>
or <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.
E.g.
SELECT jobid, emailid
FROM [_Job]
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.
E.g.
%%[
SET @emailidRows = LOOKUPROWS("_Job", "JobID", 8675309 )
SET @Row = ROW(@emailidRows,1)
SET @emailid = FIELD(@Row,"EmailID")
]%%
<br>
EmailID: %%=v(@emailid)=%%
<br>
Will output:
EmailID: 123456