Script for email receiving

Started by keiron, Sep 05, 2022, 02:01 AM

Previous topic - Next topic

keironTopic starter

Can a script be written in PHP to receive standard e-mails, and what tools would be required to do so, including libraries and functions? Furthermore, is there a pre-existing script with a registered e-mail accessible via a URL that can be logged into by forwarding the login and password? If this is possible, instructions on how to achieve it would be appreciated. If there are any available scripts or resources on this topic, any information would be greatly appreciated.

  •  

Kevin56

A multitude of PHP webmail programs can be found online, such as NOCC, a webmail client that uses IMAP and POP3 and can be hosted at home. Alternatively, there are existing services that allow you to access your POP3 mail remotely through the internet, including Mail2Web.
Regarding the question of entering a page generated by another script, it's unclear what is being asked. If the purpose is to display the content of a web page to users, CURL can be used to achieve this. The provided code snippet shows an example of how to use CURL to fetch a web page with login credentials and store its contents in a variable.

Expanding on this topic, CURL is a powerful tool that can be used for various tasks related to web development. It enables PHP scripts to communicate with remote servers via HTTP, HTTPS, FTP, and more, allowing for the retrieval and manipulation of web pages, data, and files. However, like with any web automation tool, it's important to use CURL ethically and follow best practices to avoid violating web scraping policies or using malicious intents.

<?php
$url
="http://mail4web.com";
$ch curl_init();
curl_setopt($chCURLOPT_URL$url);
curl_setopt ($chCURLOPT_POST1);
curl_setopt ($chCURLOPT_POSTFIELDS"mailaddress=youremail&password=yourpassword&");
curl_setopt ($chCURLOPT_RETURNTRANSFER1);
$store curl_exec ($ch);
$content curl_exec ($ch);
curl_close ($ch); 
?>

  •  

donamiller90

While there are software packages that can achieve this, basic tools like echo, sleep, and netcat can be used to complete the same tasks. The process involves connecting to a server via POP3 and using a specified username and password to retrieve and delete one email before disconnecting. However, additional protocol messages are also generated alongside the email, which can be ignored or trimmed down.

A custom bash function is provided in the text that facilitates this process. To use it, one must call it on the desired server with their username and password. If required, the text encoding can be adjusted to suit your preferences, and the fixed delay (sleep 5) in receiving emails can be adjusted accordingly.

Some servers, notably Google, do not allow simple POP3 connections and only support encrypted connections. To work around this, the stunnel program can be used to create an encrypted tunnel between the client and server, providing a secure connection to Gmail's POP3 and SMTP services.

While accessing webmail through the shell can be a valuable tool for automating certain tasks, it requires a certain level of technical knowledge and may not be suitable for all users. Additionally, certain email providers have policies against automated access to their services, so it's crucial to review the terms and conditions before attempting to use these methods.
  •