how many emails are sent per day

Published on



















It cost you nothing other then your internet cost. So its perfect method for sending bulk emails where you can send to email,gmail,hotmail,yahoo etc. or any other domain.

Here we are attaching how to send email using gmail smtp in c#

Send mails using SMTP in PHP by gmail server or own domain server

Create library file for the SMTP Settings 'library.php':

1

2

3

4

5

6

7


<?php

error_reporting(0);

define("SMTP_HOST", "SMTP_HOST_NAME"); //Hostname of the mail server

define("SMTP_PORT", "SMTP_PORT"); //Port of the SMTP like to be 25, 80, 465 or 587

define("SMTP_UNAME", "VALID_EMAIL_ACCOUNT"); //Username for SMTP authentication any valid email created in your domain

define("SMTP_PWORD", "VALID_EMAIL_ACCOUNTS_PASSWORD"); //Password for SMTP authentication

?>

Create new page called 'sendmail.php' for send SMTP mails:










1

2

3

4

5

6

7

8

9

10


<form action="" method="post">

<table>

<tr>

<td><input type="email" placeholder="Email" name="email" /></td>

</tr>

<tr>

<td><input type="submit" name="send" value="Send via SMTP" /></td>

</tr>

</table>

</form>

Make the form post and do the below actions:










1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28


<?php

include 'library.php';

include "classes/class.phpmailer.php"; // include the class file name

if(isset($_POST["send"]))

$email = $_POST["email"];

$mail = new PHPMailer; // call the class

$mail->IsSMTP();

$mail->Host = SMTP_HOST; //Hostname of the mail server

$mail->Port = SMTP_PORT; //Port of the SMTP like to be 25, 80, 465 or 587

$mail->SMTPAuth = true; //Whether to use SMTP authentication

$mail->Username = SMTP_UNAME; //Username for SMTP authentication any valid email created in your domain

$mail->Password = SMTP_PWORD; //Password for SMTP authentication

$mail->AddReplyTo("reply@yourdomain.com", "Reply name"); //reply-to address

$mail->SetFrom("from@yourdomain.com", "Asif18 SMTP Mailer"); //From address of the mail

// put your while loop here like below,

$mail->Subject = "Your SMTP Mail"; //Subject od your mail

$mail->AddAddress($email, "Asif18"); //To address who will receive this email

$mail->MsgHTML("<b>Hi, your first SMTP mail has been received. Great Job!.. <br/><br/>by <a href='http://jsmtp.com'>Asif18</a></b>"); //Put your body of the message you can place html code here

$mail->AddAttachment("images/asif18-logo.png"); //Attach a file here if any or comment this line,

$send = $mail->Send(); //Send the mails

if($send)

echo '<center><h3 style="color:#009933;">Mail sent successfully</h3></center>';

else

echo '<center><h3 style="color:#FF3300;">Mail error: </h3></center>'.$mail->ErrorInfo;

?>

Mostly SMTP's are using for send Bulk emails. There are many bulk email providers such as SMTPServer.in(Simple Email Service). We can use Amazon SES, Google mail server etc. to send SMTP mails via google means just change the SMTP settings like below,










1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23


<?php

include "classes/class.phpmailer.php"; // include the class name

$mail = new PHPMailer(); // create a new object

$mail->IsSMTP(); // enable SMTP

$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only

$mail->SMTPAuth = true; // authentication enabled

$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail

$mail->Host = "smtp.gmail.com";

$mail->Port = 465; // or 587

$mail->IsHTML(true);

$mail->Username = "mohamedasif18@gmail.com";

$mail->Password = "**********";

$mail->SetFrom("anyemail@gmail.com");

$mail->Subject = "Your Gmail SMTP Mail";

$mail->Body = "<b>Hi, your first SMTP mail via gmail server has been received. Great Job!.. <br/><br/>by <a href='http://jsmtp.com'>Asif18</a></b>";

$mail->AddAddress("mohamedasif18@gmail.com");

if(!$mail->Send())

echo "Mailer Error: " . $mail->ErrorInfo;

else

echo "Message has been sent";

?>

Note : Gmail is using SSL for security. for this you need to enable "extension=php_openssl.dll" in your php.ini file, if you are using ubuntu here you can go! the above gmail code will works in ubuntu without any php.ini modifications.

If you want to send emails to many without knowing others email address like newsletter and subscription emails replace these lines after '$mail->Subject = "Your SMTP Mail";',










1

2

3

4

5

6

7

8

9

10

11

12


$recipients = array(

'asif18@asif18.com' => 'Asif 18',

'mohamedasif18@gmail.com' => 'Mohamed Asif'

);

foreach($recipients as $email => $name)

$mail->AddAddress($email, $name); //To address who will receive this email

$mail->MsgHTML("<b>Hi, your first SMTP mail has been received. Great Job!.. <br/><br/>by <a href='http://mailsgo.com'>Asif18</a></b>"); //Put your body of the message you can place html code here

$mail->AddAttachment("images/asif18-logo.png"); //Attach a file here if any or comment this line(using absolute path),

$mail->Send(); //Send the mails

// if you want to does not show other users email addresses like newsletter, daily, weekly, subscription emails means use the below line to clear previous email address

$mail->ClearAddresses();

$mail->ClearAddresses(); will clear the previous email address while sending bulk emails like newsletters, email subscriptions. By this other users email addressess will not be shown on their Mailbox 'To' field. If you want to show all the emails to other users means just comment or remove the line.

http://www.codeproject.com/Articles/29943/Send-Emails-in-ASP-NET-using-Gmail-Credentials

http://www.asif18.com/7/php/send-mails-using-smtp-in-php-by-gmail-server-or-own-domain-server/

jSMTP.com SMTP Server Install Instructions

*auto account activation after static ip validation

News - Contact

Comment on this post