@@ -108,36 +108,36 @@ const sendEmailCampaign = async (options: EmailCampaignOptions = {}): Promise<vo
108108
109109 const resend = new Resend ( apiKey ) ;
110110
111- // const userBatches = await getUserBatches(50);
111+ // const userBatches = await getUserBatches(50);
112+ // console.log(
113+ // `Preparing to send emails to ${userBatches.length} batches of users (${50} per batch)`
114+ // );
115+
116+ // const emailPromises = userBatches.map(async (batch, i) => {
117+ // const bccEmails = batch.map((user) => user.email);
112118 // console.log(
113- // `Preparing to send emails to ${userBatches.length} batches of users (${50} per batch) `
119+ // `Preparing batch ${i + 1}/ ${userBatches.length} with ${bccEmails.length} recipients `
114120 // );
115121
116- // const emailPromises = userBatches.map(async (batch, i) => {
117- // const bccEmails = batch.map((user) => user.email);
118- // console.log(
119- // `Preparing batch ${i + 1}/${userBatches.length} with ${bccEmails.length} recipients`
120- // );
121-
122- // const { data, error } = await resend.emails.send({
123- // from: `${fromName} <${fromEmail}>`,
124- // to: toEmail,
125- // // bcc: bccEmails,
126- // subject,
127- // react: React.createElement(GenerateNewsletter, {
128- // recentLandlordProperties,
129- // lovedProperties,
130- // recentAreaProperties,
131- // }),
132- // });
133-
134- // if (error) {
135- // console.error(`Error sending batch ${i + 1}:`, error);
136- // } else {
137- // console.log(`Batch ${i + 1} sent successfully! ID:`, data?.id || 'no ID returned');
138- // }
122+ // const { data, error } = await resend.emails.send({
123+ // from: `${fromName} <${fromEmail}>`,
124+ // to: toEmail,
125+ // // bcc: bccEmails,
126+ // subject,
127+ // react: React.createElement(GenerateNewsletter, {
128+ // recentLandlordProperties,
129+ // lovedProperties,
130+ // recentAreaProperties,
131+ // }),
139132 // });
140133
134+ // if (error) {
135+ // console.error(`Error sending batch ${i + 1}:`, error);
136+ // } else {
137+ // console.log(`Batch ${i + 1} sent successfully! ID:`, data?.id || 'no ID returned');
138+ // }
139+ // });
140+
141141 // await Promise.all(emailPromises);
142142 // console.log('All email batches sent successfully!');
143143 // } catch (err) {
@@ -149,26 +149,26 @@ const sendEmailCampaign = async (options: EmailCampaignOptions = {}): Promise<vo
149149 * To use, uncomment code below, comment out lines 82-86 and 108-143, edit info below,
150150 * and run the file as normal.
151151 */
152- // try {
153- // // In your main file
154- // const { data, error } = await resend.emails.send({
155- // from: 'updates@cuapts.org',
156- // to: 'laurenpothuru@gmail.com ',
157- // subject: subject,
158- // react: React.createElement(GenerateNewsletter, {
159- // recentLandlordProperties,
160- // lovedProperties,
161- // recentAreaProperties,
162- // }),
163- // });
164- // if (error) {
165- // console.error('Error sending email:', error);
166- // } else {
167- // console.log('Email sent successfully! ID:', data ? data.id : ' no ID returned.');
168- // }
169- // } catch (err) {
170- // console.error('Exception when sending email:', err);
171- // }
152+ try {
153+ // In your main file
154+ const { data, error } = await resend . emails . send ( {
155+ from : 'updates@cuapts.org' ,
156+ to : 'lsp75@cornell.edu ' ,
157+ subject,
158+ react : React . createElement ( GenerateNewsletter , {
159+ recentLandlordProperties,
160+ lovedProperties,
161+ recentAreaProperties,
162+ } ) ,
163+ } ) ;
164+ if ( error ) {
165+ console . error ( 'Error sending email:' , error ) ;
166+ } else {
167+ console . log ( 'Email sent successfully! ID:' , data ? data . id : ' no ID returned.' ) ;
168+ }
169+ } catch ( err ) {
170+ console . error ( 'Exception when sending email:' , err ) ;
171+ }
172172} ;
173173
174174/**
0 commit comments