@@ -1485,8 +1485,7 @@ <h4>Poornima Institute of Engineering and Technology</h4>
14851485 </ div >
14861486 </ section >
14871487
1488- <!-- Contact Section -->
1489- < section id ="contact " class ="section contact-section ">
1488+ < section id ="contact " class ="section contact-section ">
14901489 < div class ="container ">
14911490 < h2 class ="section-title "> Let's Connect</ h2 >
14921491 < div class ="contact-content ">
@@ -1533,13 +1532,22 @@ <h3>Get in Touch</h3>
15331532 </ div >
15341533 </ section >
15351534
1535+
15361536 <!-- Footer -->
15371537 < footer class ="footer ">
15381538 < div class ="container ">
15391539 < p > © 2024 Sourav Sharma. Crafted with passion and Three.js</ p >
15401540 </ div >
15411541 </ footer >
15421542
1543+ < script src ="https://cdn.jsdelivr.net/npm/@emailjs/browser@4/dist/email.min.js "> </ script >
1544+ < script >
1545+ ( function ( ) {
1546+ emailjs . init ( "ivo1olSGcP4aPhXdU" ) ; // ✅ Your Public Key
1547+ } ) ( ) ;
1548+ </ script >
1549+
1550+
15431551 <!-- Scripts -->
15441552 < script >
15451553 // Global variables
@@ -2040,7 +2048,7 @@ <h3>Get in Touch</h3>
20402048 } , 100 ) ;
20412049 }
20422050
2043- // Contact form
2051+ // Contact form - FIXED VERSION
20442052 function initContactForm ( ) {
20452053 const contactForm = document . getElementById ( 'contact-form' ) ;
20462054
@@ -2067,12 +2075,25 @@ <h3>Get in Touch</h3>
20672075 submitBtn . textContent = 'Sending...' ;
20682076 submitBtn . disabled = true ;
20692077
2070- setTimeout ( ( ) => {
2078+ // Send email using EmailJS
2079+ emailjs . send ( "service_sg599um" , "template_lcm6s9q" , {
2080+ from_name : name ,
2081+ from_email : email ,
2082+ subject : subject ,
2083+ message : message
2084+ } )
2085+
2086+ . then ( ( ) => {
20712087 alert ( 'Message sent successfully! Thank you for reaching out.' ) ;
20722088 contactForm . reset ( ) ;
20732089 submitBtn . textContent = originalText ;
20742090 submitBtn . disabled = false ;
2075- } , 2000 ) ;
2091+ } , ( error ) => {
2092+ alert ( 'Failed to send message. Please try again later or contact me directly at mr.sourav.sharma.01@gmail.com' ) ;
2093+ console . error ( 'EmailJS Error:' , error ) ;
2094+ submitBtn . textContent = originalText ;
2095+ submitBtn . disabled = false ;
2096+ } ) ;
20762097 } ) ;
20772098 }
20782099
0 commit comments