开发者

How do I send emails using a Perl script [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the开发者_开发技巧 help center. Closed 11 years ago.

This is for my last exam, so i would be very grateful if someone helped me.

I've been told to write Perl script for sending e-mails to many users. It`s supposed to work like this:

1) The script reads an .html document that is supposed to be the body of the email.

2) It reads .txt document that contains all the e-mail addresses (divided by ";") that the email should be sent to. There may be hundreds, thousands e-mail addresses.

3) The script should somehow read the SMTP settings for sending the e-mail.

I`m looking forward to anyone's answer.

Thanks in advance...


You can find an example on Robert Maldons blog. Check http://robertmaldon.blogspot.com/2006/10/sending-email-through-google-smtp-from.html


Firstly, I am not going to write the code for you - you will benefit so much more if you attempted to write the code yourself.

1) You need to read the "body" file and store it for use later in the script.

2) Again read the contents of the "email address" file, you may need to use the split function to seperate the emails addresses. Store these in an array, perhaps you may want to validate each email address before adding it to the array.

3) For every entry in the array - send the email. For sending the emails you could use the following module Net::SMTP


look for Net::SMTP::SSL It has everything with the code snippet You only need to add syntax

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜